apoc.create.removePropertiesProcedureDeprecated in Cypher 25
| 
 This procedure is deprecated.
To dynamically remove properties, use Cypher’s   | 
Syntax  | 
  | 
||
Description  | 
Removes the given properties from the given   | 
||
Input arguments  | 
Name  | 
Type  | 
Description  | 
  | 
  | 
The nodes to remove properties from.  | 
|
  | 
  | 
The property keys to remove from the given nodes.  | 
|
Return arguments  | 
Name  | 
Type  | 
Description  | 
  | 
  | 
The updated node.  | 
|
Remove Properties using Cypher
Properties can be referenced dynamically in Cypher without using APOC.
REMOVE n[key]
The dynamically calculated key must evaluate to a STRING value.
For more information, see the Cypher Manual → Dynamically removing a property.
Usage Examples
The examples in this section are based on the following sample graph:
CREATE (jennifer:Person {name: "Jennifer", community: 1, partition: 4})
CREATE (karin:Person {name: "Karin", community: 4, partition: 2})
CREATE (elaine:Person {name: "Elaine", community: 3, partition: 3})
MERGE (jennifer)-[:FRIENDS {since: datetime("2019-06-01")}]-(karin)
MERGE (jennifer)-[:FRIENDS {since: datetime("2019-05-04")}]-(elaine);
We can delete all properties except for name from Person nodes by using both APOC and Cypher:
CALL db.propertyKeys()
YIELD propertyKey WHERE propertyKey <> "name"
WITH collect(propertyKey) AS propertyKeys
MATCH (p:Person)
WITH collect(p) AS nodes, propertyKeys
CALL apoc.create.removeProperties(nodes, propertyKeys)
YIELD node
RETURN node;
CALL db.propertyKeys()
YIELD propertyKey WHERE propertyKey <> "name"
WITH collect(propertyKey) AS propertyKeys
MATCH (p:Person)
FOREACH (key IN propertyKeys | REMOVE p[key])
RETURN DISTINCT p
| node | 
|---|
(:Person {name: "Jennifer"})  | 
(:Person {name: "Karin"})  | 
(:Person {name: "Elaine"})  |