diff --git a/src/content/docs/cypher/expressions/node-rel-functions.md b/src/content/docs/cypher/expressions/node-rel-functions.md index 4259341..b194b8a 100644 --- a/src/content/docs/cypher/expressions/node-rel-functions.md +++ b/src/content/docs/cypher/expressions/node-rel-functions.md @@ -10,6 +10,7 @@ The following functions are used to get information about nodes and relationship | `ID` | returns the internal ID of node/rel | | | `LABEL` | returns the label name of node/relationship | `LABELS` | | `OFFSET` | returns the offset of the internal ID | | +| `PROPERTIES` | returns a struct of all user-defined properties of node/rel | | See below for more details on each of these functions. @@ -77,3 +78,25 @@ MATCH (a) RETURN OFFSET(ID(a)) AS OFFSET LIMIT 1; │ 0 │ └────────┘ ``` + +## PROPERTIES + +Returns a `STRUCT` containing all user-defined properties of a node or relationship, omitting internal metadata columns (`_ID`, `_LABEL`, `_SRC`, `_DST`). + +| Input type | Output type | +| --- | --- | +| `NODE` | `STRUCT` | +| `REL` | `STRUCT` | + +```cypher +MATCH (a:User {name: 'Alice'}) RETURN PROPERTIES(a) AS props; +``` + +```table +┌───────────────────────────────────────────┐ +│ props │ +│ STRUCT(name STRING, age INT64) │ +├───────────────────────────────────────────┤ +│ {name: Alice, age: 30} │ +└───────────────────────────────────────────┘ +``` diff --git a/src/content/docs/cypher/expressions/struct-functions.md b/src/content/docs/cypher/expressions/struct-functions.md index 3f1be3d..e7f3c40 100644 --- a/src/content/docs/cypher/expressions/struct-functions.md +++ b/src/content/docs/cypher/expressions/struct-functions.md @@ -21,5 +21,6 @@ The functions that can be used with structs are as follows: | Function | Description | Example | Result | | ----------- | ----------- | ----------- | ----------- | | `struct_extract(struct, 'field_name')` | Extracts named field from struct | `struct_extract({name: 'Alice', age: 20}, 'name')` | `'Alice'` | +| `properties(struct)` | Returns the struct of properties | `properties({name: 'Alice', age: 20})` | `{name: Alice, age: 20}` | \ No newline at end of file