apoc.map.setValues

Function

apoc.map.setValues(map Map<String, Any>, pairs [[key Any, value Any]]) - adds or updates the alternating key/value pairs (e.g. [key1,value1,key2,value2]) in a map. == Signature

apoc.map.setValues(map :: MAP?, pairs :: LIST? OF ANY?) :: (MAP?)

Input parameters

Name Type Default

map

MAP?

null

pairs

LIST? OF ANY?

null

Usage Examples

The following updates a key in a map:

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