How to delete a list of nodes from Label

Hi Team,

Need your help in knowing the query to delete a list of nodes passed as an argument to cypher query to delete them from given label.

Regards
Akshat

Hello @akshat.mittal :slight_smile:

I think you are looking for REMOVE clause.

Regards,
Cobra

Hi Cobra,

Thank you for quick input.

I am aware with REMOVE / DELETE clause. Here , I need the REMOVAL of list of NODES from specific label.
List of nodes means 100 nodes or 50 nodes at a time eligible for deletion.

So in a nutshell , First Query gives the output of nodes for deletion and Second query takes the output of First query and use as an input and performs deletion.

I hope it makes sense.

Regards
Akshat

I'm not sure you can pass nodes as parameters, are you forced to do two queries or we can propose a solution with one query?

Can you give the RETURN clause of the first query?

Hi Cobra,

Below is my Query and Its output -

Query - MATCH (n:DATALABEL) where n.TYPE = 'MDS' RETURN n.NAME LIMIT 5

Output -

"IJAMBDSRSWTW0002ENBMDS001"
"IDLHICHDPNB0005ENBMDS001"
"NASDBRGXXXXNB0001ENTMDS002"
"IASDBRGXXXXNB0001ENTMDS001"
"GJGDHWXXXXTW0007ENBMDS001"

Regards
Akshat

And you want to delete the node or only the label?

MATCH (n:DATALABEL)
WHERE n.TYPE = 'MDS'
WITH n
LIMIT 5
REMOVE n:DATALABEL

Hi Cobra ,

I want to delete the nodes.

Regards
Akshat

MATCH (n:DATALABEL)
WHERE n.TYPE = 'MDS'
WITH n
LIMIT 5
DETACH DELETE n

Thanks Cobra,

I will run and check the result.

Thanks Again.

Regards
Akshat