apoc.coll.duplicatesWithCount

Function

apoc.coll.duplicatesWithCount(coll LIST<ANY>) - returns a LIST<ANY> of duplicate items in the collection and their count, keyed by item and count.

Signature

apoc.coll.duplicatesWithCount(coll :: LIST<ANY>) :: LIST<ANY>

Input parameters

Name Type Default

coll

LIST<ANY>

null

Usage examples

The following returns duplicates in a list of maps containing an item and its count:

RETURN apoc.coll.duplicatesWithCount([1,3,5,7,9,9]) AS output;
Table 1. Results
Output
[
    {
      "count": 2,
      "item": 9
    }
]