Jagadeesh Urlana
Jagadeesh Urlana

Reputation: 87

How to remove/delete duplicate nodes from RedisGraph

Can someone help me on deleting duplicate nodes from the RedisGraph for a particular label. I found cypher queries in Neo4j, but the are not supporting in Redis. Please help me on this.

I used below query, then RedisInsight thrown error

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

Error: RedisGraph does not currently support list comprehension

Upvotes: 1

Views: 676

Answers (1)

SWilly22
SWilly22

Reputation: 879

To delete duplicates you can use the following

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

Upvotes: 4

Related Questions