Removing graph elements - nodes, relationships and properties, is done with DELETE
.
To remove a node from the graph, you can delete it with the DELETE
clause.
Query
START n = node(4) DELETE n
Nothing is returned from this query, except the count of affected nodes.
If you are trying to remove a node with relationships on it, you have to remove these as well.
Query
START n = node(3) MATCH n-[r]-() DELETE n, r
Nothing is returned from this query, except the count of affected nodes.
Neo4j doesn’t allow storing null in properties. Instead, if no value exists, the property isjust not there. So, to remove a property value on a node or a relationship, is also done with DELETE
.
Query
START andres = node(3) DELETE andres.age RETURN andres
The node is returned, and no property age exists on it.
Copyright © 2012 Neo Technology