Using Match and Where can delete a relationship by ID.
Match ()-[r]-() Where ID(r)=1 Delete r
Is there a simpler way?
In Neo4j to delete a node or relations between nodes you have to use DELETE clause. To delete any node you need DELETE clause with the MATCH statement, the MATCH statement data will find the specific node and whichever node is matched with the statement that node will be vanished.
Deleting Nodes with Relationships Attached One option is to delete all relationships, then delete the node. Another option is to use the DETACH DELETE clause. The DETACH DELETE clause lets you delete a node and all relationships connected to it.
There is a method to delete a node and all relationships related to that node. Use the DETACH DELETE statement: Example: MATCH (Kohli:player{name: "Virat Kohli"}) DETACH DELETE Kohli.
Remove a property Neo4j doesn't allow storing null in properties. Instead, if no value exists, the property is just not there. So, REMOVE is used to remove a property value from a node or a relationship. The node is returned, and no property age exists on it.
You can delete by simple modified chyper for delete some Relations.
This is my code:
MATCH ()-[r]->() WHERE id(r)=43 OR id(r)=44 OR id(r)=45 DELETE r
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