apoc.map.sortedPropertiesFunction
Syntax |
|
||
Description |
Returns a |
||
Arguments |
Name |
Type |
Description |
|
|
The map to extract the properties from. |
|
|
|
Whether or not to take the case into account when sorting. The default is: |
|
Returns |
|
||
Usage Examples
The following examples return a list of key/value pairs with each pair sorted by alphabetically their key using both APOC and Cypher:
apoc.map.sortedProperties
WITH {name:"Cristiano Ronaldo",country:"Portugal",dob:date("1985-02-05")} AS map
RETURN apoc.map.sortedProperties(map) AS output
Using Cypher’s list comprehension and coll.sort()
WITH {name: "Cristiano Ronaldo", country: "Portugal", dob: date("1985-02-05")} AS map
RETURN [k IN coll.sort(keys(map)) | [k, map[k]]]
| output |
|---|
[["country","Portugal"],["dob","1985-02-05"],["name","Cristiano Ronaldo"]] |