neo4j Neo.ClientError.Transaction.TransactionHookFailed

你。 提交于 2019-12-24 09:27:03

问题


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.


回答1:


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()


来源:https://stackoverflow.com/questions/47925772/neo4j-neo-clienterror-transaction-transactionhookfailed

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!