问题
The procedure apoc.create.relationship(n1,RelType,{},n2) behaves accordingly to the CREATE statement.
If a relationship of type RelType
already exists between nodes n1 and n2 apoc.create.relationship() will create a duplicate.
Is there an equivalent version of apoc.create.relationship() that behaves like MERGE?
回答1:
There is a procedure
apoc.merge.relationship()
which takes same parameters as apoc.create.relationship()
and should do what you need.
It has been mentioned in this blog post, but it seems to be missing from documentation - see this issue.
来源:https://stackoverflow.com/questions/52273703/merge-instead-of-create-for-apoc-create-relationship