如何从redisgraph中删除重复节点

ymdaylpp  于 2021-06-09  发布在  Redis
关注(0)|答案(1)|浏览(489)

有人能帮我从redisgraph中删除某个标签的重复节点吗。我在neo4j中找到了cypher查询,但是redis不支持。请帮我解决这个问题。
我用下面的查询,然后抛出错误

MATCH (p:Person)
WITH p.id as id , collect(p) AS nodes 
WHERE size(nodes) >  1
RETURN [ n in nodes | n.id ] AS ids, size(nodes)
ORDER BY size(nodes) DESC

错误:redisgraph当前不支持列表理解

j2qf4p5b

j2qf4p5b1#

要删除重复项,可以使用以下命令

MATCH (p:Person)
WITH p.id as id, collect(p) AS nodes 
WHERE size(nodes) >  1
UNWIND nodes[1..] AS node
DELETE node

相关问题