apoc.map.setLists

Details

Syntax

apoc.map.setLists(map, keys, values)

Description

Adds or updates the given keys/value pairs provided in LIST<ANY> format (e.g. [key1, key2],[value1, value2]) in a MAP.

Arguments

Name

Type

Description

map

MAP

The map to be updated.

keys

LIST<STRING>

A list of keys to add or update the map with.

values

LIST<ANY>

A list of values associated to the keys to add or update the map with.

Returns

MAP

Usage Examples

The following updates a key in a map:

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