I am trying to count the number of elements in a list
UNWIND [{id:'0001',name:'Test',size:'10mm'}] as rows
RETURN count(rows)
However this always returns 1. For this example the return value should be 3, even if the list is empty then it should return 0.
Your datastructure is a 1-element array containing a map with 3 elements.
This returns 3:
unwind [{id:'0001',name:'Test',size:'10mm'}] as map
return size(keys(map))
You cannot apply size on a map, therefore use keys() to get an array of keys from the map.
Thanks for the help stefen.armbruster