Search code snippets, questions, articles... Chrome Extension

Delete a node using id Cypher query

The Cypher query can be used to delete nodes using node id that is auto-assigned by neo4j to every node.
MATCH (n:Person) 
WHERE ID(n)=10
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place. Check how cool is the tool

The above Cypher query will match the nodes that have a Person label associated with them. Then it will filter the nodes that have id 10 and then it will delete that node along with its relationship to other nodes.

MATCH (n:Movie {id: 5})
If you have created your own id property in a node and have assigned some value to it, then you can delete this node using that property value by executing the above query.
The query will delete the node that has the label Movie and has property id which has a value 5.
Was this helpful?
Join Devsheet Ask a Question