Reputation: 111
Currently - there does not appear to be a way to determine if a property value in a node (or relationship) is an array/collection or a string.
match (n) where isArray(n.myprop) ....
this would be super handy when trying to understand the types of data you are working with relative to your updates and queries. Specifically, if you had situations were you were trying to update property values and needed to know "how" to update them based on how the current values were stored.
Upvotes: 7
Views: 2842
Reputation: 41686
Right now there is nothing built in but it would be a good addition. Feel free to raise an issue on github.
Something like this could help until then?
CREATE ({ a:1,b:"a",c: [1,2,3]})
MATCH (a)
RETURN size(a.a),
CASE a.a
WHEN toInt(a.a)
THEN 'int'
WHEN toFloat(a.a)
THEN 'float'
WHEN toString(a.a)
THEN 'string'
WHEN [x IN a.a | x]
THEN 'coll'
WHEN NULL THEN 'null'
ELSE 'unknown' END , size(a.b), size(a.c)
Upvotes: 3