Skip to content

Instantly share code, notes, and snippets.

@gigenthomas
Forked from CliffordAnderson/collect.cypher
Last active July 11, 2018 02:58
Show Gist options
  • Save gigenthomas/dbe627c41b2e66c851570d546dd8bf70 to your computer and use it in GitHub Desktop.
Save gigenthomas/dbe627c41b2e66c851570d546dd8bf70 to your computer and use it in GitHub Desktop.
A Cypher examples to unwind and collect
COLLECT - Gathers data into a List
========================================
match (a {name:"Daniel"}), (b {name:"Jerry"})
with a,b
match s = shortestPath(a-[]-b)
unwind nodes(s) as n
with collect(n) as m
return head(m)
MATCH(u:User)
WITH u
ORDER BY u.name
WITH COLLECT({name:u.name,date:u.date}) AS userinfo
RETURN userinfo
match (a {name:"Daniel"}), (b {name:"Jerry"})
with a,b
match s = shortestPath(a-[]-b)
unwind nodes(s) as n
return n.name as Names
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment