apoc.map.setEntry

In APOC 2025.06, this function was removed from the APOC Core library. Use apoc.map.setKey instead.

If you are using APOC 2025.06 or later, the function is not available in Cypher 25 but can still be used with Cypher 5. For more information, see APOC and Cypher versions.

Details

Syntax

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