From c79bc2d0d2c0db857c536082c1bb7bcb5e113a15 Mon Sep 17 00:00:00 2001 From: "abby.huang" <78209557+abby-cyber@users.noreply.github.com> Date: Fri, 26 May 2023 09:35:52 +0800 Subject: [PATCH] allow-expression-like-return-v.tag (#2781) * allow-expression-like-return-v.tag * Update return.md --- .../8.clauses-and-options/return.md | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 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 21cc4deeda6..41d36194f77 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 @@ -60,7 +60,7 @@ nebula> RETURN {zage: 32, name: "Marco Belinelli"}; ```ngql // 返回点 -nebula> MATCH (v:player) \ +nebula> MATCH (v:player) \ RETURN v; +---------------------------------------------------------------+ | v | @@ -129,22 +129,27 @@ nebula> MATCH (v:player{name:"Tim Duncan"}) \ ## 返回属性 -使用语法`..`返回点的属性;使用语法`.`返回边的属性。 +返回点的属性时,必需指定属性所属的 Tag,因为点可以有多个 Tag,并且同一个属性名可以在不同的 Tag 上出现。 + +支持指定点的 Tag 返回该 Tag 的所有属性;也支持指定点的 Tag 和某个属性名,返回该 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 | ++--------------------------------------+---------------------+--------------+ ``` +返回边的属性时,无需指定属性所属的 Edge type,因为边只能有一个 Edge type。 + ```ngql // 返回边的属性 nebula> MATCH (v:player{name:"Tim Duncan"})-[e]->() \ @@ -158,7 +163,6 @@ nebula> MATCH (v:player{name:"Tim Duncan"})-[e]->() \ +--------------+----------+ ``` - 使用`properties()`函数返回点或边的所有属性。 ```ngql