I have a requirement to delete ALL nodes and relationships from a parent/root node and NOT delete the parent/root node. The graph Database contains 2 labels (User and Contact) to group the nodes.
Currently I am able accomplish this with the following script, where '6' is the parent/node
MATCH (u:User)-[r]-(c:Contact)
WHERE u.email = '[email protected]' AND ID(c) > 6
DELETE c, r
Is there a better way to do this?
Is there a way to tell Neo4J not to delete the parent/root node?
ID(c) <> 6
? – jjaderberg