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.

Neo4jError: Invalid input 'N': expected whitespace, comment, '{', node

I am trying to create a relation at the same time I create a node. I am using javascript neo4j driver.
When I run the query in neo4j desktop it works but not when using the driver.

session.run(`
                          match (a:Node1) where a.name = "Jon Doe"
                         create (b:Node2)<-[r:Reln]-(a) 
                         set b.name = ${args.name}
                         return a,b,r
                     `)
1 ACCEPTED SOLUTION

Hi,

can you try to use proper parameters in your cypher like $name and pass them as a map ot the driver?
(same for your literal "Jon Doe" value.)

please also share the full error message that should contain the query that Cypher sees.

I guess i your case you would have needed to use "${args.name}" so that there are quotes around your string.

View solution in original post

2 REPLIES 2

Hi,

can you try to use proper parameters in your cypher like $name and pass them as a map ot the driver?
(same for your literal "Jon Doe" value.)

please also share the full error message that should contain the query that Cypher sees.

I guess i your case you would have needed to use "${args.name}" so that there are quotes around your string.

Thank you very much.. such a silly mistake from my part...