Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow-expression-like-return-v.tag #2100

Merged
merged 1 commit into from
May 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions docs-2.0/3.ngql-guide/8.clauses-and-options/return.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,22 +126,24 @@ nebula> MATCH (v:player{name:"Tim Duncan"}) \

## Return properties

To return a vertex or edge property, use the `{<vertex_name>|<edge_name>}.<property>` 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 `<vertex_name>.<tag_name>.<property_name>` to return the property of a vertex; use the syntax `<edge_name>.<property_name>` 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
Expand Down