apoc.nodes.delete

Details

Syntax

apoc.nodes.delete(nodes, batchSize) :: (value)

Description

Deletes all NODE values with the given ids.

Input arguments

Name

Type

Description

nodes

ANY

The nodes to be deleted. Nodes can be of type STRING (elementId()), INTEGER (id()), NODE, or LIST<STRING | INTEGER | NODE>.

batchSize

INTEGER

The number of node values to delete in a single batch.

Return arguments

Name

Type

Description

value

INTEGER

The number of deleted nodes.

Usage Examples

The examples in this section are based on the following graph:

CREATE (:Student {name: 'Alice', score: 71});
CREATE (:Student {name: 'Mark', score: 95});
CREATE (:Student {name: 'Andrea', score: 86});

We can return the internal IDs of these nodes using the id function:

MATCH (s:Student)
RETURN id(s) AS id;
Results
id

3975

3976

3977

CALL apoc.nodes.delete([3975, 3976, 3977], 2);
Results
value

3