apoc.coll.sortMaps
Function
apoc.coll.sortMaps(list [Map<String, Any>], prop String)
- sorts the given list into ascending order, based on the map property indicated by prop
.
Usage examples
The following sorts a list of maps in reverse alphabetical order by the key name
:
RETURN apoc.coll.sortMaps([
{name: "Lionel Messi"},
{name: "Cristiano Ronaldo"},
{name: "Wayne Rooney"}
], "name") AS output;
Output |
---|
|
The following sorts a list of maps in alphabetical order by the key name
:
RETURN apoc.coll.sortMaps([
{name: "Lionel Messi"},
{name: "Cristiano Ronaldo"},
{name: "Wayne Rooney"}
], "^name") AS output;
Output |
---|
|
Was this page helpful?