apoc.map.setValues

Details

Syntax

apoc.map.setValues(map, pairs)

Description

Adds or updates the alternating key/value pairs (e.g. [key1,value1,key2,value2]) in a MAP.

Arguments

Name

Type

Description

map

MAP

The map to be updated.

pairs

LIST<ANY>

A list of items listed pairwise to add or update the map with.

Returns

MAP

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