apoc.map.setKey

Function APOC Core

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

Signature

apoc.map.setKey(map :: MAP?, key :: STRING?, value :: ANY?) :: (MAP?)

Input parameters

Name Type Default

map

MAP?

null

key

STRING?

null

value

ANY?

null

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;
Table 1. Results
Output
{
  "name": "Cristiano Ronaldo",
  "country": "Portugal",
  "dob": "1986-02-06"
}