cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Creating nested object

I am trying to add data to the database using the following cypher code:

UNWIND [
    {location: 'Westmere', resource: {medicine: [{unit: 1}], sustenance: [{unit: 1}], equipment: [{unit: 1}]}},
    {location: 'Ponsonby', resource: {medicine: [{unit: 1}], sustenance: [{unit: 1}], equipment: [{unit: 1}]}},
    {location: 'Greylynn', resource: {medicine: [{unit: 1}], sustenance: [{unit: 1}], equipment: [{unit: 1}]}},
    {location: 'Eden Terrace', resource: {medicine: [{unit: 1}], sustenance: [{unit: 1}], equipment: [{unit: 1}]}},
    {location: 'Auckland Central', resource: {medicine: [{unit: 1}], sustenance: [{unit: 1}], equipment: [{unit: 1}]}},
    {location: 'Parnell', resource: {medicine: [{unit: 1}], sustenance: [{unit: 1}], equipment: [{unit: 1}]}},
    {location: 'New Market', resource: {medicine: [{unit: 1}], sustenance: [{unit: 1}], equipment: [{unit: 1}]}}
] AS row CREATE (:Location {location: row.location, resource: row.resource});

But I get an error as:

Neo.ClientError.Statement.TypeError: Property values can only be of primitive types or arrays thereof. Encountered: Map{equipment -> List{Map{unit -> Long(1)}}, medicine -> List{Map{unit -> Long(1)}}, sustenance -> List{Map{unit -> Long(1)}}}.

How should I create the resource object? Any help would be appreciated

0 REPLIES 0