apoc.map.mergeFunction
Syntax |
|
||
Description |
Merges the two given |
||
Arguments |
Name |
Type |
Description |
|
|
The first map to merge with the second map. |
|
|
|
The second map to merge with the first map. |
|
Returns |
|
||
Usage examples
The following merges two maps:
apoc.map.merge
WITH {name: "Cristiano Ronaldo", dob: date("1985-02-05")} AS map1, {country: "Portugal"} AS map2
RETURN apoc.map.merge(map1, map2) AS output;
Cypher’s Map Comprehension
WITH {name: "Cristiano Ronaldo", dob: date("1985-02-05")} AS map1, {country: "Portugal"} AS map2
RETURN { k IN keys(map1) + keys(map2) | k: coalesce(map2[k], map1[k]) } AS output;
| Output |
|---|
{
"name": "Cristiano Ronaldo",
"country": "Portugal",
"dob": "1985-02-05"
}
|