Skip to content

Commit c180585

Browse files
authored
Add a clearer deprecation message for replacing the user of paths in the size() function. (#515)
Size() cannot accept a path anymore (as of 4.0), but can take pattern comprehension and could now be replaced with 5.0 feature, COUNT. This PR makes this replacement clearer to the users.
1 parent 94802d8 commit c180585

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3271,7 +3271,18 @@ label:restricted[]
32713271
size()
32723272
----
32733273
a|
3274-
No longer works for paths. Only works for strings, lists and pattern expressions. See xref:functions/scalar.adoc#functions-size[size()] for more details.
3274+
Only works for strings, lists and pattern comprehensions, and no longer works for paths.
3275+
For versions above 5.0, use a `COUNT` expression instead:
3276+
[source, cypher, role="noheader"]
3277+
----
3278+
RETURN COUNT { (a)-[]->(b) }
3279+
----
3280+
For versions below 5.0, use a pattern comprehension instead:
3281+
[source, cypher, role="noheader"]
3282+
----
3283+
RETURN size([ (a)-[]->(b) \| a ])
3284+
----
3285+
See xref:functions/scalar.adoc#functions-size[size()] and xref:syntax/expressions.adoc#count-subqueries[Count Subqueries] for more details.
32753286
|===
32763287

32773288
=== Updated features

0 commit comments

Comments
 (0)