cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Number of distinct elements in an array property

Is it possible to calculate a number of distinct elements of an array property per each node?

1 REPLY 1

yes if you get the elements, then you can use count(distinct e)

for your example:

match (p:Person)
where p.id in ["1", "2"]
unwind p.embed as e
return p, count(distinct e)

or you can use size(apoc.coll.toSet(p.embed))