How to determine type of property value in node in neo4j?

Currently - there is no way to determine if a property value in a node (or relation) is an array / collection or string.

match (n) where isArray (n.myprop) ....

it would be very convenient when trying to understand the types of data you are working with regarding your updates and queries. In particular, if you had situations, you tried to update the values ​​of the properties and you needed to know how to update them, based on how the current values ​​were saved.

+6
source share
1 answer

There is nothing built in right now, but that would be a good addition. Feel free to raise a question about github.

Something like this can help until then?

CREATE ({ a:1,b:"a",c: [1,2,3]}) MATCH (a) RETURN size(aa), CASE aa WHEN toInt(aa) THEN 'int' WHEN toFloat(aa) THEN 'float' WHEN toString(aa) THEN 'string' WHEN [x IN aa | x] THEN 'coll' WHEN NULL THEN 'null' ELSE 'unknown' END , size(ab), size(ac) 
+3
source

Source: https://habr.com/ru/post/978845/


All Articles