apoc.coll.containsAll

Details

Syntax

apoc.coll.containsAll(coll1, coll2)

Description

Returns whether or not all of the given values exist in the given collection (using a HashSet).

Arguments

Name

Type

Description

coll1

LIST<ANY>

The list to search for the given values in.

coll2

LIST<ANY>

The list of values in the given list to check for the existence of.

Returns

BOOLEAN

Usage examples

The following checks if a collection contains all the values from another collection:

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

FALSE

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

TRUE

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

TRUE