For the following data:
create (a:Attendee {name:'luanne'}); create (a:Attendee {name:'adam'}); create (a:Attendee {name:'christoph'}); create (a:Attendee {name:'vince'}); create (a:Attendee {name:'michal'});
this request
MATCH p=(n:Attendee)-[r*0..1]-(m) WITH p order by head(nodes(p)).name return collect(distinct(p))
when executed through shell return paths of length one, ordered by the name of the first node in the path.
However, through the REST API:
POST http://localhost:7474/db/data/transaction/commit {"statements":[ {"statement":"MATCH p=(n:`Attendee`)-[r*0..1]-(m) WITH p order by head(nodes(p)).name return collect(distinct(p))","parameters":{},"resultDataContents":["graph"]} ]}]}
the same order is not supported (looks like it is ordered by node identifier).
How to fix my Cypher to give me the same results as when running through the shell?
PS. Works great if resultDataContents is a string, and also when COLLECT is not used in REST
source share