user2384600
user2384600

Reputation: 29

Cypher: create or update query a node throws an error

Need some help insert or update using cypher.

I have the following cypher query:

cypher = 'MERGE (user:Person:User {email: {email}}) ON CREATE user = {props} SET user.created = timestamp() ON MATCH SET user.lastSeen = timestamp() RETURN user';

This seem to throw a error:

errorError: Invalid input 'u': expected whitespace, comment or SET (line > 1, column 53)
"MERGE (user:Person:User {email: {email}}) ON CREATE user = {props} SET > user.created = timestamp() ON MATCH SET user.lastSeen = timestamp() RETURN > user"

Upvotes: 0

Views: 146

Answers (1)

Michael Hunger
Michael Hunger

Reputation: 41676

you forgot the first SET

cypher = '
    MERGE (user:Person:User {email: {email}}) 
    ON CREATE SET user = {props}, user.created = timestamp() 
    ON MATCH SET user.lastSeen = timestamp() 
    RETURN user';

Upvotes: 1

Related Questions