Cypher: `WITH *` is legit?


(Alec Muffett) #1

Hello All! I am looking for documentation that confirms that WITH * is a supported construct

I can’t find it on:

https://neo4j.com/docs/developer-manual/current/cypher/clauses/with/

...but it came up in an example on Slack a few days ago, and it seems to work?


(Michael Hunger) #2

Yes it is legit and quite useful if you don't want to repeat yourself time and again :slight_smile:
Same for return *


(Andrew Bowman) #3

Just be aware that if you're calling an aggregation function in your WITH clause, it's best to be explicit unless you're sure WITH * is correct, since the other variables in scope give context to the aggregation and form the grouping key.


(Alec Muffett) #4

Finally found it documented under RETURN * and mentally extrapolated to WITH * :slight_smile:
Thanks for the tips, all.