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.

Order of Property Keys

andy_hegedus
Graph Fellow

Hi,

More on the curiosity side on property keys, but it could have an impact on stats calculations.
Very simple query to get the property keys on nodes

MATCH (n)
RETURN labels(n),keys(n), count(*)

What seemed a bit odd were the results,
The nodes with more than 1 key would have different orders of the keys, though not all the permutations. If I wanted to further process the results I would need to account for that permutation.
|Label|Keys|Count|
|[word]|[pos, term, count]|15103|
|[word]|[count, pos, term]|412|
|[word]|[term, pos, count]|124|

When entering the data it all came from the same CSV file in the same operation.
Is this expected behavior?
Andy

1 REPLY 1

There is no order, they keys are afaik in the order of addition to the node.

You can sort them before aggregation.
e.g. with apoc.coll.sort() or with an unwind + sort + collect