What is the behaviour and purpose of the new Cypher operator DETACH DELETE
added in Neo4j 2.3.x?
Remove all properties REMOVE cannot be used to remove all existing properties from a node or relationship. Instead, using SET with = and an empty map as the right operand will clear all properties from the node or relationship.
To delete nodes and relationships using Cypher, use the DELETE clause. The DELETE clause is used within the MATCH statement to delete whatever data was matched. So, the DELETE clause is used in the same place we used the RETURN clause in our previous examples.
Deleting relationship is as simple as deleting nodes. Use the MATCH statement to match the relationships you want to delete. You can delete one or many relationships or all relationships by using one statement.
If you want to delete nodes, you need to delete the relationships as well. In previous versions you would need to do:
MATCH (n)
OPTIONAL MATCH (n)-[r]-()
DELETE n, r
Now you can simply say:
MATCH (n)
DETACH DELETE n
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With