apoc.map.mget
Syntax |
|
||
Description |
Returns a |
||
Arguments |
Name |
Type |
Description |
|
|
The map to extract a list of values from. |
|
|
|
The list of keys to extract. |
|
|
|
The default values of the given keys. The default is: |
|
|
|
If a key is not present and no default is provided, it will either throw an exception if true, or return a null value The default is: |
|
Returns |
|
Usage Examples
The following returns a list of values for keys name
and country
:
WITH {name:"Cristiano Ronaldo",country:"Portugal",dob:date("1985-02-05")} AS map
RETURN apoc.map.mget(map, ["name", "country"]) AS output;
Output |
---|
["Cristiano Ronaldo", "Portugal"] |
The following returns a list of values for keys name
and country
, and default value defaultValue
for missing key missingKey
:
WITH {name:"Cristiano Ronaldo",country:"Portugal",dob:date("1985-02-05")} AS map
RETURN apoc.map.mget(
map,
["name", "country", "missingKey"],
[null, null, "defaultValue"]
) AS output;
Output |
---|
["Cristiano Ronaldo", "Portugal", "defaultValue"] |