diff --git a/modules/ROOT/pages/clauses/where.adoc b/modules/ROOT/pages/clauses/where.adoc index 90334ffab..a021f9c0d 100644 --- a/modules/ROOT/pages/clauses/where.adoc +++ b/modules/ROOT/pages/clauses/where.adoc @@ -185,12 +185,19 @@ The `name`, `age` and `email` values for `Peter` are returned because `Andy` has To filter on a property using a dynamically computed name, use square bracket syntax: +.Parameters +[source, parameters] +---- +{ + "propname": "age" +} +---- + .Query [source, cypher] ---- -WITH 'AGE' AS propname MATCH (n:Person) -WHERE n[toLower(propname)] < 30 +WHERE n[$propname] < 30 RETURN n.name, n.age ---- diff --git a/modules/ROOT/pages/syntax/parameters.adoc b/modules/ROOT/pages/syntax/parameters.adoc index 41a006e10..06a4f0605 100644 --- a/modules/ROOT/pages/syntax/parameters.adoc +++ b/modules/ROOT/pages/syntax/parameters.adoc @@ -15,14 +15,16 @@ Additionally, parameters make caching of execution plans much easier for Cypher, Parameters can be used for: -* literals and expressions -* node and relationship ids +* Literals and expressions. +* Node and relationship ids. +* Properties, when referenced dynamically (for more information, see xref:clauses/where.adoc#filter-on-dynamic-property[Filter on dynamically-computed node property]). +* Node labels and relationship types, when referenced dynamically (for more information, see xref:clauses/match.adoc#dynamic-match[`MATCH` using dynamic node labels and relationship types]). label:new[Introduced in 5.26] Parameters cannot be used for the following constructs, as these form part of the query structure that is compiled into a query plan: -* property keys; so `MATCH (n) WHERE n.$param = 'something'` is invalid -* relationship types; so `MATCH (n)-[:$param]->(m)` is invalid -* labels; so `MATCH (n:$param)` is invalid +* Property keys; `MATCH (n) WHERE n.$param = 'something'` is invalid. +* Relationship types; `MATCH (n)-[:$param]->(m)` is invalid. +* Node labels; `MATCH (n:$param)` is invalid. Parameters may consist of letters and numbers, and any combination of these, but cannot start with a number or a currency symbol.