From 56b45c009e62e3950c8818b54c6075f9fc1ac83a Mon Sep 17 00:00:00 2001 From: "abby.huang" <78209557+abby-cyber@users.noreply.github.com> Date: Fri, 26 May 2023 16:56:26 +0800 Subject: [PATCH] allow-expression-like-return-v.tag (#2100) --- .../8.clauses-and-options/return.md | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/docs-2.0/3.ngql-guide/8.clauses-and-options/return.md b/docs-2.0/3.ngql-guide/8.clauses-and-options/return.md index adb726af0ba..422fed469fa 100644 --- a/docs-2.0/3.ngql-guide/8.clauses-and-options/return.md +++ b/docs-2.0/3.ngql-guide/8.clauses-and-options/return.md @@ -126,22 +126,24 @@ nebula> MATCH (v:player{name:"Tim Duncan"}) \ ## Return properties -To return a vertex or edge property, use the `{|}.` syntax. +When returning properties of a vertex, it is necessary to specify the tag to which the properties belong because a vertex can have multiple tags and the same property name can appear on different tags. + +It is possible to specify the tag of a vertex to return all properties of that tag, or to specify both the tag and a property name to return only that property of the tag. ```ngql nebula> MATCH (v:player) \ - RETURN v.player.name, v.player.age \ + RETURN v.player, v.player.name, v.player.age \ LIMIT 3; -+------------------+--------------+ -| v.player.name | v.player.age | -+------------------+--------------+ -| "Danny Green" | 31 | -| "Tiago Splitter" | 34 | -| "David West" | 38 | -+------------------+--------------+ ++--------------------------------------+---------------------+--------------+ +| v.player | v.player.name | v.player.age | ++--------------------------------------+---------------------+--------------+ +| {age: 33, name: "LaMarcus Aldridge"} | "LaMarcus Aldridge" | 33 | +| {age: 25, name: "Kyle Anderson"} | "Kyle Anderson" | 25 | +| {age: 40, name: "Kobe Bryant"} | "Kobe Bryant" | 40 | ++--------------------------------------+---------------------+--------------+ ``` -Use the syntax `..` to return the property of a vertex; use the syntax `.` to return the property of an edge. +When returning edge properties, it is not necessary to specify the edge type to which the properties belong, because an edge can only have one edge type. ```ngql // Return the property of a vertex