Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
11 changes: 9 additions & 2 deletions modules/ROOT/pages/clauses/where.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
----

Expand Down
12 changes: 7 additions & 5 deletions modules/ROOT/pages/syntax/parameters.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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-dynamic-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.

Expand Down
Loading