Property DataType - apoc.meta.type
Node Properties in Neo4j.
A property can be of any datatype even within nodes of the same label. Nodes have no fixed schema as with the RDBMS where most notions of data storage are formed and 'best practice' is enforced.
Properties themselves do not have types, but the values they hold do. However, you can have a property, X which could be assigned a string value or a numeric value. There is no enforcement of typing for a property. Of course, it would not (always) make sense to assign a property different type values in your graph.
So, just what datatype is the property?
Trusty APOC has a function for that.
WITH [true, 42, 'foo', 1.2] AS data
UNWIND data as value
RETURN apoc.meta.type(value)
So, just what datatype is the property?
"BOOLEAN"
"INTEGER"
"STRING"
"FLOAT"
You can use this function in MATCHES on nodes in your system where properties are unknown at runtime.
MATCH (n:MyNode) RETURN apoc.meta.type(n.MyProperty)
Comments
Post a Comment