我有一些重复的节点,都带有标签Tag。所谓的重复是指我有两个具有相同名称属性的节点,例如:
{ name: writing, _id: 57ec2289a90f9a2deece7e6d},
{ name: writing, _id: 57db1da737f2564f1d5fc5a1},
{ name: writing }
_id
字段不再使用,因此在所有效果中,这三个节点是相同的,只是它们每个人都有不同的关系。
我想做的是:
Find all duplicate nodes (check)
MATCH (n:Tag) WITH n.name AS name, COLLECT(n) AS nodelist, COUNT(*) AS count WHERE count > 1 RETURN name, nodelist, count
Copy all relationships from the duplicate nodes into the first one
- Delete all the duplicate nodes
count(*)
。 - InverseFalcon