cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! Site migration is underway. Phase 2: migrate recent content

Sort nodes with apoc.coll.sortNodes multiple properties

Sandip
Node Link
  • neo4j 3.4.8
    Hi,

I'm using <apoc.coll.sortNodes(collect(i),'event_date') as elems> to sort my nodes but I want to sort on multiple properties like event_date and priority. Is it possible with apoc.coll.sortNodes?

Regards,
Sandip

2 REPLIES 2

You'll want to use apoc.coll.sortMulti(), however this will use the node properties maps rather than the nodes themselves, so you won't be able to do additional things with the items in the collection that you could normally do with nodes (match from them, use them in pattern expressions, get their graph id, visualize results in the graphical view). There is a workaround you can use to get around that if needed.

Sandip
Node Link

Thanks Andrew, this solved my problem.

Regards,
Sandip