apoc.coll.occurrences

Function

apoc.coll.occurrences(coll [Any], item Any) - returns the count of the given item in the collection.

Signature

apoc.coll.occurrences(coll :: LIST? OF ANY?, item :: ANY?) :: (INTEGER?)

Input parameters

Name Type Default

coll

LIST? OF ANY?

null

item

ANY?

null

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;
Table 1. Results
Output

2