I understand that node and relationship properties are limited to primitive types or arrays of primitive types. The "Maps" section of the Neo4j 2.1 Reference Card mentions that:
{name:'Alice', age:38, address:{city:'London', residential:true}}
Literal maps are declared in curly braces much like property maps. Nested maps and collections are supported.
Of course something like:
CREATE (alice {name:'Alice', age:38, address:{city:'London', residential:true}})
throws an exception:
Error: Property values can only be of primitive types or arrays thereof Neo.ClientError.Statement.InvalidType
In what context does Neo4j support nested maps and collections?
Neo4j does not allow nested arrays to be stored as properties of a node.
The create clause of Neo4j CQL is also used to create multiple nodes at the same time. To do so, you need to pass the names of the nodes to be created, separated by a comma.
Neo4j CQL CREATE a Node Label We can say this Label name to a Relationship as "Relationship Type". We can use CQL CREATE command to create a single label to a Node or a Relationship and multiple labels to a Node. That means Neo4j supports only single Relationship Type between two nodes.
With UNWIND , you can transform any list back into individual rows.
(Edited)
The reference card is a bit too subtle. The most important word is "literal". In other words, you can only use arbitrarily nested maps and arrays in literals, but you cannot store such things in a node or relationship.
For example, this works:
WITH {name:'Alice', age:38, address:[{city:'London', residential:true}, {city: 'Paris', residential: false} ]} AS x
RETURN x;
But this fails:
CREATE (x {name:'Alice', age:38, address:[{city:'London', residential:true}, {city: 'Paris', residential: false} ]})
RETURN x;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With