apoc.coll.contains

Function

apoc.coll.contains(coll [Any], value Any) - returns whether or not the given value exists in the given collection (using a HashSet).

Signature

apoc.coll.contains(coll :: LIST? OF ANY?, value :: ANY?) :: (BOOLEAN?)

Input parameters

Name Type Default

coll

LIST? OF ANY?

null

value

ANY?

null

Usage examples

The following checks if a collection contains a value:

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

true

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

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

false