REMOVE
The REMOVE
clause is used to remove properties from nodes and relationships, and to remove labels from nodes.
For deleting nodes and relationships, see |
Removing labels from a node is an idempotent operation: if you try to remove a label from a node that does not have that label on it, nothing happens. The query statistics will tell you if something needed to be done or not. |
The examples use the following database:
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.
MATCH (a {name: 'Andy'})
REMOVE a.age
RETURN a.name, a.age
The node is returned, and no property age
exists on it.
a.name | a.age |
---|---|
|
|
Rows: 1 |
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.