update

This method can be used to update nodes, and maps to the underlying Update Mutation.

Returns a Promise that resolves to the equivalent of the Mutation response for this operation.

Example

For the User with name "John", update their name to be "Jane":

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

const { users } = await User.update({
    where: { name: "John" },
    update: { name: "Jane" },
});

Arguments

Name and Type Description

where

Type: GraphQLWhereArg

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

update

Type: any

A JavaScript object representation of the GraphQL update input type used for Update Mutations.

connect

Type: any

A JavaScript object representation of the GraphQL connect input type used for Update Mutations.

disconnect

Type: any

A JavaScript object representation of the GraphQL disconnect input type used for Update Mutations.

create

Type: any

A JavaScript object representation of the GraphQL create input type used for Update Mutations.

options

Type: GraphQLOptionsArg

A JavaScript object representation of the GraphQL options input type used for Sorting and Pagination.

selectionSet

Type: string or DocumentNode or SelectionSetNode

Selection set for the Mutation, see Selection Set for more information.

args

Type: any

The args value for the GraphQL Mutation.

context

Type: any

The context value for the GraphQL Mutation.

rootValue

Type: any

The rootValue value for the GraphQL Mutation.