Reputation: 22171
Using Cypher (Neo4j 2.1.2), it seems that array properties do not work well with aggregate functions.
For instance, I can have a RETURN
clause like this:
RETURN meeting.title, count(participant) as number_part
Output: MyTitle 2
It well returns all the meetings's titles grouped by participants.
However, with an array as property rather than simple one like title
, the output is strange:
RETURN meeting.arrayProperty, count(participant) as number_part
Output:
MyTitle [1,2,3] 1
MyTitle [1,2,3] 1 //not grouped by ...
Better than text, here's a graphgist I made to explain the issue, the workaround I found and what I really expect.
Does anyone know the reason? (maybe obvious...)
Upvotes: 1
Views: 182
Reputation: 39915
Just tried the following workaround: rebuild the array property as an collection:
RETURN extract(x in meeting.arrayProperty | x), count(participant) as number_part
Theory: the array property is handled as java native array whereas extract
returns a collection (in Java sense). Comparing collections works based on comparing the elements whereas comparing a native array compares memory addresses which are different.
Upvotes: 2