Type Alias Mutation<R>

Mutation:
    | { create: SanityDocumentStub<R> }
    | { createOrReplace: IdentifiedSanityDocumentStub<R> }
    | { createIfNotExists: IdentifiedSanityDocumentStub<R> }
    | { delete: MutationSelection }
    | { patch: PatchMutationOperation }

A mutation operation to be performed. Used in transactions to batch multiple changes.

Type Parameters

  • R extends Record<string, Any> = Record<string, Any>
client.transaction()
.create({_type: 'bike', name: 'New Bike'})
.delete('old-bike')
.patch('bike-123', p => p.set({inStock: false}))
.commit()