MERGE当其中一个属性具有唯一约束时

Kri*_*tty 4 neo4j cypher

我正在尝试使用以下查询创建或更新节点:

MERGE (u:Book{id:{id1},name:{name1}}) RETURN u

在这里,id是唯一的,但名称可以改变.

但是,这不适用于更新.

我得到以下错误:

Node 38 already exists with label Book and property "id"=[1166]

当其中一个属性具有唯一约束时,我不能使用MERGE吗?

注意:版本:neo4j-enterprise-2.0.1架构:索引ON:Book(id)ONLINE(用于唯一性约束)

约束ON(书:书)ASSERT book.guid IS UNIQUE

Nic*_*ite 9

用途SET:

MERGE (b:Book {id:{id1}})
SET b.name = {name1}
RETURN b
Run Code Online (Sandbox Code Playgroud)