delete

This method can be used to delete nodes, and maps to the underlying Delete Mutation.

Returns a Promise which resolvers to a DeleteInfo object:

Name and Type Description

nodesDeleted

Type: number

The number of nodes deleted.

relationshipsDeleted

Type: number

The number of relationships deleted.

Example

To delete all User nodes where the name is "Dan":

const User = ogm.model("User");

await User.delete({ where: { name: "Dan" }});

Arguments

Name and Type Description

where

Type: GraphQLWhereArg

A JavaScript object representation of the GraphQL where input type used for Filtering.

delete

Type: string or DocumentNode or SelectionSetNode

A JavaScript object representation of the GraphQL delete input type used for Delete Mutations.

context

Type: any

The context value for the GraphQL Mutation.

rootValue

Type: any

The rootValue value for the GraphQL Mutation.