Star

Created With

linkDeleting Nodes

A QueryRunner instance can be used for deleting nodes from Objects. A label and a where parameter can be used.

1link/* --> let 'queryRunner' be a QueryRunner instance and 'session' and already-created session */

2linkconst result = await queryRunner.delete({

3link /* --> (optional) label(s) of the nodes to be matched. Multiple labels like 'User:Person' can also be used */

4link label: 'User',

5link /* --> (optional) the where clause for the nodes to be matched. A param object or a Where instance can be used */

6link where: { // @see [Where](../Where-Parameters)

7link /* --> the identifier needs to be used as a key */

8link u: {

9link id: {

10link /* --> using the "in" Symbol from "Op" */

11link $[Op.in]: ['1', '2']

12link }

13link }

14link },

15link /* --> (optional) the identifier of the nodes for the query. Is needed for parsing the results. Default is the value of 'QueryRunner.identifiers.default' */

16link identifier: 'u',

17link /* --> (optional) adds the DETACH keyword to the delete statement, also deleting the relationships of the node(s) */

18link detach: true,

19link /* --> (optional) an existing session or transaction to use */

20link session: null,

21link});

22link

23link/* --> the result is the QueryResult from the neo4j driver */

24linkconsole.log(result.summary.counters.updates().nodesDeleted);

Deleting Nodes

Introduction Getting Started

Modelschevron_right

Sessions and Transactions

Query Builderchevron_right
Query Runnerchevron_right

Bind Parameters

Where Parameters