apoc.map.setKey

Details

Syntax

apoc.map.setKey(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.setKey(
    {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"
}