apoc.coll.occurrences

Details

Syntax

apoc.coll.occurrences(coll, item)

Description

Returns the count of the given item in the collection.

Arguments

Name

Type

Description

coll

LIST<ANY>

The list to collect the count of the given value from.

item

ANY

The value to count in the given list.

Returns

INTEGER

Usage examples

The following returns the number of occurrences of the value 9 in a list:

RETURN apoc.coll.occurrences([1,3,5,7,9,9], 9) AS output;
Results
Output

2