apoc.coll.occurrences

Function APOC Core

apoc.coll.occurrences(coll, item) - 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