cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Delete nodes with a condition

lingvisa
Graph Fellow

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?

1 ACCEPTED SOLUTION

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

View solution in original post

2 REPLIES 2

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.