Skip to content

Commit 8080399

Browse files
Dynamic node labels within list (#1156)
* Add documentation for dynamic node labels within list * update wording --------- Co-authored-by: katarinasupe <[email protected]> Co-authored-by: Katarina Supe <[email protected]>
1 parent d8f9573 commit 8080399

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

pages/querying/expressions.mdx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ MATCH (n:$label)
5454
RETURN n;
5555
```
5656

57+
This syntax supports parameters of type `String` and `List[String]`, allowing a
58+
node to have one or multiple labels assigned.
59+
5760
Using parameters as property maps is partially supported, it isn't supported in `MATCH` nor `MERGE`
5861
clause. For example, the following query is illegal:
5962

@@ -109,6 +112,26 @@ session.run('CREATE (alice:Person {name: $0, age: $1})',
109112
To use parameters with some other driver, please consult the appropriate
110113
documentation.
111114

115+
## Dynamic node labels creation
116+
117+
Starting from version 3.1, Memgraph allows node labels to be created using
118+
expressions of type `String` or `List[String]`.
119+
120+
For example, the following query will create a node with the label `Foo`:
121+
122+
```
123+
WITH {label: "Foo"} as var
124+
CREATE (:var.label);
125+
```
126+
127+
while the following query will result in the creation of node labels `Foo` and `Bar`.
128+
129+
```
130+
WITH {labels: ["Foo", "Bar"]} as var
131+
CREATE (:var.labels);
132+
```
133+
134+
112135
## CASE
113136

114137
Conditional expressions can be expressed in the Cypher language with the `CASE`

0 commit comments

Comments
 (0)