Mahsa Hassankashi
Mahsa Hassankashi

Reputation: 2139

Neo4j - Nested Collection By Using UNWIND and MERGE With Error: Property values can only be of primitive types or arrays thereof

I have this kind of collection:

datas = {name:'Mahsa', address:[{city:'Berlin', residential:true}, {city: 'Paris', residential: false} ]}

 UNWIND { datas } AS data
 MERGE (p:Person { name : '" + data.name + "'  } ) ON CREATE SET p.address=" + data.address+ "

I got this error: "Property values can only be of primitive types or arrays thereof"

I have read this link: Nested Maps and Collections in Neo4j 2

My question is: What can I do while I can not remove "x" from : (x {name:'Alice', age:38, address:[{city:'London', residential:true}, {city: 'Paris', residential: false} ]})

because I am unwinding it instead of simple WITH.

and I read also: Nested Map With Create or Merge Statement

Nested maps are supported as constructs in cypher and expression results, return values but not in the underlying Neo4j storage.

Is it possible that Neo4j accept nested collection for storage?

Upvotes: 2

Views: 2250

Answers (1)

cybersam
cybersam

Reputation: 66989

Property values can not be nested. This means, for example, that an array property can only contain primitive values (of the same type).

You may want to consider having separate Address nodes related to each Person.

Upvotes: 4

Related Questions