apoc.map.merge

This function is deprecated. Use Cypher’s map addition instead.

Details

Syntax

apoc.map.merge(map1, map2)

Description

Merges the two given MAP values into one MAP.

Arguments

Name

Type

Description

map1

MAP

The first map to merge with the second map.

map2

MAP

The second map to merge with the first map.

Returns

MAP

Usage examples

The following merges two maps:

Cypher’s map addition
RETURN {name: "Cristiano Ronaldo", dob: date("1985-02-05")} + {country: "Portugal"} AS output;
apoc.map.merge
RETURN apoc.map.merge(
    {name: "Cristiano Ronaldo", dob: date("1985-02-05")},
    {country: "Portugal"}
) AS output;
Results
output
{
  "name": "Cristiano Ronaldo",
  "country": "Portugal",
  "dob": "1985-02-05"
}