apoc.map.clean

Details

Syntax

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

Description

Filters the keys and values contained in the given LIST<ANY> values.

Arguments

Name

Type

Description

map

MAP

The map to clean.

keys

LIST<STRING>

The list of property keys to be removed.

values

LIST<ANY>

The list of values to be removed.

Returns

MAP

Usage Examples

The following removes empty string values from a map:

RETURN apoc.map.clean({name: "Cristiano Ronaldo", club: ""}, [], [""]) AS output;
Results
Output
{
  "name": "Cristiano Ronaldo"
}

The following removes empty string values and the keys dob and country from a map:

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