diff --git a/pages/querying/expressions.mdx b/pages/querying/expressions.mdx index c749d5b5b..11d1fb45b 100644 --- a/pages/querying/expressions.mdx +++ b/pages/querying/expressions.mdx @@ -54,6 +54,9 @@ MATCH (n:$label) RETURN n; ``` +This syntax supports parameters of type `String` and `List[String]`, allowing a +node to have one or multiple labels assigned. + Using parameters as property maps is partially supported, it isn't supported in `MATCH` nor `MERGE` clause. For example, the following query is illegal: @@ -109,6 +112,26 @@ session.run('CREATE (alice:Person {name: $0, age: $1})', To use parameters with some other driver, please consult the appropriate documentation. +## Dynamic node labels creation + +Starting from version 3.1, Memgraph allows node labels to be created using +expressions of type `String` or `List[String]`. + +For example, the following query will create a node with the label `Foo`: + +``` +WITH {label: "Foo"} as var +CREATE (:var.label); +``` + +while the following query will result in the creation of node labels `Foo` and `Bar`. + +``` +WITH {labels: ["Foo", "Bar"]} as var +CREATE (:var.labels); +``` + + ## CASE Conditional expressions can be expressed in the Cypher language with the `CASE`