Delete nodes with a condition

MATCH (n) WHERE NOT EXISTS(n.date) DETACH DELETE n

I want to delete nodes with no date as shown above. This seems working. Is it safe?

Hello @lingvisa,

What do you want to know by 'is it safe'?

You can add the label node if you only want to check one type of node:)

Regards,
Cobra

Your query deletes all nodes with no date property as well as any relationships that those nodes have. And yep it's safe.

1 Like