apoc.map.setEntry

Details

Syntax

apoc.map.setEntry(map, key, value)

Description

Adds or updates the given entry in the MAP.

Arguments

Name

Type

Description

map

MAP

The map to be updated.

key

STRING

The key to add or update the map with.

value

ANY

The value to set the given key to.

Returns

MAP

Usage Examples

The following updates a key in a map:

RETURN apoc.map.setEntry(
    {name:"Cristiano Ronaldo",country:"Portugal",dob:date("1985-02-05")},
    "dob",
    date("1986-02-06")
) AS output;
Results
Output
{
  "name": "Cristiano Ronaldo",
  "country": "Portugal",
  "dob": "1986-02-06"
}