You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 3220028
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: README.md
+18Lines changed: 18 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -854,6 +854,23 @@ WHERE 'Alice' IN COLLECT { MATCH (p)-[:KNOWS]->(f:Person) RETURN f.name }
854
854
RETURN p.name
855
855
```
856
856
857
+
**Bare-pattern shorthand:**`EXISTS` and `COUNT` also accept a graph pattern directly, without the `MATCH` keyword (with an optional trailing `WHERE`). `COLLECT` does not support this form because it needs a `RETURN` to know which value to collect.
858
+
859
+
```cypher
860
+
// EXISTS with a bare pattern
861
+
MATCH (p:Person)
862
+
WHERE EXISTS { (p)-[:KNOWS]->(:Person) }
863
+
RETURN p.name
864
+
865
+
// COUNT with a bare pattern, in RETURN
866
+
MATCH (p:Person)
867
+
RETURN p.name, COUNT { (p)-[:KNOWS]->(:Person) } AS friendCount
868
+
869
+
// COUNT with a bare pattern and inner WHERE
870
+
MATCH (p:Person)
871
+
RETURN p.name, COUNT { (p)-[:KNOWS]->(f:Person) WHERE f.age > 30 } AS closeFriends
0 commit comments