apoc.coll.contains

Details

Syntax

apoc.coll.contains(coll, value)

Description

Returns whether or not the given value exists in the given collection (using a HashSet).

Arguments

Name

Type

Description

coll

LIST<ANY>

The list to search for the given value.

value

ANY

The value in the list to check for the existence of.

Returns

BOOLEAN

Usage examples

The following checks if a collection contains a value:

RETURN apoc.coll.contains([1,2,3,4,5], 4) AS output;
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;
Results
Output

false