Neo4j Cypher: control order of MATCH based on input array?
Question
I'm writing a query that iterates over some set of nodes:
MATCH (foo:Bar)
WHERE foo.id IN {ids}
Is there any way for me to specify/require/ensure that the matched nodes be in the same order as the input ids
array?
As an analogy, with Neo4j 1.x, this was the behavior with native ID lookups:
START foo=node({ids})
For trivial cases, I can always re-order the results on the client myself. In this particular case, my query does some additional processing, and I want to make sure the nodes get processed in the right order.
Here's a console example to experiment with:
http://console.neo4j.org/r/l5oouj
Thanks!
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow