lundi 6 avril 2015

Cypher query, format/group return values

Is there a way to format the return values from a cypher query? If I do a query that returns a node and all nodes with a relation to that node ('RETURN id(startnode), id(relationnode)') i will get an array containing each relationnode with a startnode bundled.


E.g:



[
{
relationnode: 0,
startnode: 1
}, {
relationnode: 1,
startnode: 1
}
]


How i much rather would have it work, is to have the return values formated something like so:



{
relationnode: [
0, 1
],
startnode: 1
}


Is there a way to accomplish this, or is it just bad practice all together? This would be very useful if i knew that there would never be more than 1 startnode.


Edit: I know i could parse it after the query, I'd much rather be able to do it in the query though.


Aucun commentaire:

Enregistrer un commentaire