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
32 changes: 32 additions & 0 deletions modules/ROOT/pages/clauses/filter.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,38 @@ RETURN p.name AS person,
3+|Rows: 2
|===

[[filter-on-dynamic-labels-and-types]]
== Filter on dynamic labels and types

To filter on a label or relationship type using a dynamically computed value, use `$(<expr>)` where <expr> is any Cypher expression:

.Parameters
[source, parameters]
----
{
"label": "Swedish"
}
----

.Filter on a dynamically computed node label
// tag::clauses_where_dynamic[]
[source, cypher]
----
MATCH (n)
FILTER n:$($label)
RETURN labels(n) AS labels
----
// end::clauses_where_dynamic[]

.Result
[role="queryresult",options="header,footer",cols="1*<m"]
|===
| labels
| ["Person", "Swedish"]
1+d|Rows: 1
|===


[[filter-on-dynamic-properties]]
== Filter on dynamic properties

Expand Down
32 changes: 32 additions & 0 deletions modules/ROOT/pages/clauses/where.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,38 @@ RETURN f.name AS oldFriend
|===


[[filter-on-dynamic-labels-and-types]]
== Filter on dynamic labels and types

To filter on a label or relationship type using a dynamically computed value, use `$(<expr>)` where <expr> is any Cypher expression:

.Parameters
[source, parameters]
----
{
"label": "Swedish"
}
----

.Filter on a dynamically computed node label
// tag::clauses_where_dynamic[]
[source, cypher]
----
MATCH (n)
WHERE n:$($label)
RETURN labels(n) AS labels
----
// end::clauses_where_dynamic[]

.Result
[role="queryresult",options="header,footer",cols="1*<m"]
|===
| labels
| ["Person", "Swedish"]
1+d|Rows: 1
|===


[[filter-on-dynamic-properties]]
== Filter on dynamic properties

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,31 @@ Cypher 25 was introduced in Neo4j 2025.06 and can only be used on Neo4j 2025.06+
Features removed in Cypher 25 are still available on Neo4j 2025.06+ databases either by prepending a query with `CYPHER 5` or by having Cypher 5 as the default language for the database.
For more information, see xref:queries/select-version.adoc[].

[[cypher-deprecations-additions-removals-2025.07]]
== Neo4j 2025.07

=== Updated in Cypher 25

[cols="2", options="header"]
|===
| Feature
| Details

a|
label:functionality[]
label:updated[]
[source, cypher, role="noheader"]
----
MATCH (n)-[r]->()
WHERE n:$(<expr1>)
WITH n, r:$(<expr2>) AS hasType
RETURN n:$(<expr3>)
----

| Added the ability to dynamically reference node labels and relationship types in places where xref:patterns/reference.adoc#label-expressions[label expressions] are allowed.
|===


[[cypher-deprecations-additions-removals-2025.06]]
== Neo4j 2025.06

Expand Down
13 changes: 13 additions & 0 deletions modules/ROOT/pages/patterns/reference.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,19 @@ The following matches relationships that have a type that is neither `A` nor `B`
-[:!A&!B]->
----

[[dynamic-label-and-type-expressions]]
=== Dynamic label and type expressions

Node labels and relationship types can be referenced dynamically in expressions, parameters, and variables within label expressions.

.Syntax for creating nodes and relationships dynamically
[source, syntax]
----
dynamicLabelExpression ::= ":$(" + valueExpression ")"
----

The `valueExpression` must evaluate to a `STRING NOT NULL | LIST<STRING NOT NULL> NOT NULL` value.

[[property-key-value-expressions]]
== Property key-value expressions

Expand Down