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 DELETE.

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:

graph remove clause

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.

Query
MATCH (a {name: 'Andy'})
REMOVE a.age
RETURN a.name, a.age

The node is returned, and no property age exists on it.

Table 1. Result
a.name a.age

"Andy"

<null>

Rows: 1
Properties set: 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.

Remove a label from a node

To remove labels, you use REMOVE.

Query
MATCH (n {name: 'Peter'})
REMOVE n:German
RETURN n.name, labels(n)
Table 2. Result
n.name labels(n)

"Peter"

["Swedish"]

Rows: 1
Labels removed: 1

Remove multiple labels from a node

To remove multiple labels, you use REMOVE.

Query
MATCH (n {name: 'Peter'})
REMOVE n:German:Swedish
RETURN n.name, labels(n)
Table 3. Result
n.name labels(n)

"Peter"

[]

Rows: 1
Labels removed: 2