vvavepacket
vvavepacket

Reputation: 1929

neo4j Neo.ClientError.Transaction.TransactionHookFailed

I was trying to change a property to a node using

MATCH (n:User) where n.firstname = 'Mark' set n.school = 'MIT' return n

but I got this error:

Neo.ClientError.Transaction.TransactionHookFailed

Why are we getting this error? The neo4j documentation does not contain any explanation for this. Thank you.

Upvotes: 2

Views: 784

Answers (1)

Archemar
Archemar

Reputation: 571

try merge

MATCH (n:User) 
  where n.firstname = 'Mark' 
merge n.school = 'MIT' ;

you won't have any return, you should re query using match ... return

as per https://neo4j.com/docs/cypher-refcard/current/ §merge

Match a pattern or create it if it does not exist. Use ON CREATE and ON MATCH for conditional updates.

MERGE (n:Person {name: $value})
  ON CREATE SET n.created = timestamp()
  ON MATCH SET
    n.counter = coalesce(n.counter, 0) + 1,
    n.accessTime = timestamp()

Upvotes: 1

Related Questions