apoc.map.valuesFunction
Syntax |
|
||
Description |
Returns a |
||
Arguments |
Name |
Type |
Description |
|
|
A map to extract values from. |
|
|
|
A list of keys to extract from the given map. The default is: |
|
|
|
Whether or not to return missing values as null values. The default is: |
|
Returns |
|
||
Usage Examples
The following examples return a list of values for the keys name and country, and a null value for the missing key missingKey, using both APOC and Cypher:
WITH {name:"Cristiano Ronaldo",country:"Portugal",dob:date("1985-02-05")} AS map
RETURN apoc.map.values(map, ["name", "country", "missingKey"], true) AS output
WITH {name:"Cristiano Ronaldo",country:"Portugal",dob:date("1985-02-05")} AS map
RETURN [k IN ["name", "country", "missingKey"] | map[k]] AS output
| output |
|---|
["Cristiano Ronaldo","Portugal",null] |
The following examples return a list of values for the keys name and country, but nothing for the missing key missingKey, using both APOC and Cypher:
WITH {name:"Cristiano Ronaldo",country:"Portugal",dob:date("1985-02-05")} AS map
RETURN apoc.map.values(map, ["name", "country", "missingKey"], false) AS output
WITH {name:"Cristiano Ronaldo",country:"Portugal",dob:date("1985-02-05")} AS map
RETURN [k IN ["name", "country", "missingKey"] WHERE k IN keys(map) | map[k]] AS output
| output |
|---|
["Cristiano Ronaldo","Portugal"] |