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.

Create node with a list as a property

Hi

Im trying to create a new node and i want to create a property with a list of values from a variable

       tx.run('''
      MATCH (n:name {surname: $surname})
      SET n.cars = $cars
      RETURN n
             ''', surname='javi', cars = ['car1','car2','car3'])

Im having this error

neo4j.exceptions.ClientError: {code: Neo.ClientError.Statement.ParameterMissing} {message: Expected parameter(s): cars}

Any idea how can initialise a property with an array?

Thanks

1 ACCEPTED SOLUTION

Hello @javi.xeneize

Your query should work, it works for me, the error means that the query can't find the parameter cars.

Which version of Neo4j are you using and are you using the same version for the Python driver?

Regards,
Cobra

View solution in original post

5 REPLIES 5

Hello @javi.xeneize

Your query should work, it works for me, the error means that the query can't find the parameter cars.

Which version of Neo4j are you using and are you using the same version for the Python driver?

Regards,
Cobra

Hi

Yes, my understanding was that $cars refers to a string so for a list it would need something different. I will give it another try

Thanks

It's possible to store list in Neo4j but all values must have the same type: list of strings, list of integers, list of floats, etc.

List of dictionaries/maps?

You can have a look at the doc here to get all possible types. It's not possible to get list of maps or dictionnaries.