neo4j/cypher-builder

DISTINCT in Aggregating functions

Closed this issue · 1 comments

Is currently missing the support for DISTINCT in Aggregating functions.

For instance the following:
RETURN collect(DISTINCT this { .id }) AS data
or
RETURN count(DISTINCT this { .id }) AS data
Are valid Cypher.
Reference: https://neo4j.com/docs/cypher-manual/current/functions/aggregating/#_counting_with_and_without_duplicates

Aggregation functions already support DISTINCT (although it is not yet documented):

The following js should generate something similar to what you need

Cypher.collect(new Cypher.Node()).distinct();