apoc.coll.subtract

Details

Syntax

apoc.coll.subtract(list1, list2)

Description

Returns the first LIST<ANY> as a set with all the elements of the second LIST<ANY> removed.

Arguments

Name

Type

Description

list1

LIST<ANY>

The list to remove values from.

list2

LIST<ANY>

The list of values to be removed from list1.

Returns

LIST<ANY>

Usage examples

The following returns unique set of first list with all elements of second list removed:

RETURN apoc.coll.subtract([1,2,3,4,5,6,6], [3,4,5]) AS output;
Results
Output

[1, 2, 6]