Overview Defining a Model Instances Creating Nodes and Relationships Merging Nodes and Relationships Updating Nodes and Relationships Deleting Nodes Deleting Relationships Finding Nodes and Relationships Hooks Temporary Databases
Using the delete
static of a Model and providing a Where parameter, nodes of the Model can be deleted
1linkawait Users.delete({
2link /* --> the Nodes to be deleted will be matched using this param */
3link where: {
4link /* --> the node(s) to be deleted need to have the name 'John' AND the id '1' */
5link name: 'John',
6link id: '1'
7link },
8link /* --> (optional) adds the DETACH keyword to the delete statement, also deleting the relationships of the node(s) */
9link detach: true,
10link /* --> (optional) an existing session or transaction to use */
11link session: null,
12link});
Using the delete
method of an Instance, the node which corresponds to the Instance will be deleted.
1link/* --> let 'user' be a Users Instance. This node will be deleted */
2linkawait user.delete({
3link /* --> (optional) adds the DETACH keyword to the delete statement, also deleting the relationships of the node */
4link detach: true,
5link /* --> (optional) an existing session or transaction to use */
6link session: null,
7link});