Star

Created With

linkDeleting Relationships

linkDeleting Relationships via the Model static

Using the deleteRelationships static of a Model and providing a Where parameter, relationships of the Model can be deleted

1linkconst deletedCount = await Users.deleteRelationships({

2link /* --> the alias of the relationship, as provided in the Model definition */

3link alias: 'Orders',

4link /* --> the Relationships to be deleted will be matched using this param */

5link where: {

6link /* --> (optional) the relationship(s) to be deleted need to be from a User with the name 'John' AND the id '1' */

7link source: {

8link name: 'John',

9link id: '1',

10link },

11link /* --> (optional) the relationship(s) to be deleted need to be to an Order with the id '2' */

12link target: {

13link id: '2',

14link },

15link /* --> (optional) the relationship(s) to be deleted need to be match the following properties */

16link relationship: {

17link rating: 5,

18link },

19link },

20link /* --> (optional) throws NeogmaNotFoundError if no relationships were deleted */

21link throwIfNoneDeleted: false,

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

23link session: null,

24link});

25link

26linkconsole.log(deletedCount); // number of relationships deleted

Deleting RelationshipsDeleting Relationships via the Model static

Introduction Getting Started

Modelschevron_right

Sessions and Transactions

Query Builderchevron_right
Query Runnerchevron_right

Bind Parameters

Where Parameters