apoc.any.isDeletedFunction
|
This function is not considered safe to run from multiple threads. It is therefore not supported by the parallel runtime. For more information, see the Cypher Manual → Parallel runtime. |
Syntax |
|
||
Description |
Returns true if the given |
||
Arguments |
Name |
Type |
Description |
|
|
The node or relationship to check the non-existence of. |
|
Returns |
|
||
Example
Given this dataset:
CREATE (:Person {name: 'Alice'})-[:KNOWS]->(:Person {name: 'Bob'})
The following query checks whether a node and relationship are deleted, both before and after a DETACH DELETE within the same transaction:
MATCH (a:Person {name: 'Alice'})-[r:KNOWS]->()
WITH
a,
r,
apoc.any.isDeleted(a) AS beforeDeleteNode,
apoc.any.isDeleted(r) AS beforeDeleteRel
DETACH DELETE a
RETURN
beforeDeleteNode,
beforeDeleteRel,
apoc.any.isDeleted(a) AS afterDeleteNode,
apoc.any.isDeleted(r) AS afterDeleteRel
| beforeDeleteNode | beforeDeleteRel | afterDeleteNode | afterDeleteRel |
|---|---|---|---|
false |
false |
true |
true |
Before the delete, both the node and relationship still exist, so the function returns false.
After DETACH DELETE a, both have been removed and the function returns true.