DjangoFilterUpdateMutation

Will update multiple instances of a model depending on supplied filters. The returned arguments are:

  • updatedCount: The number of updated instances.
  • updatedObjects: The ids of the deleted instances.

Mutation input arguments: +————+———–+ | Argument | Type | +============+===========+ | filter | Object! | +————+———–+ | data | Object! | +————+———–+

All meta arguments:

Argument type Default Description
model Model None The model. Required.
filter_fields Tuple () A number of filter fields which allow us to restrict the instances to be deleted.
only_fields Iterable None If supplied, only these fields will be added as input variables for the model
exclude_fields Iterable None If supplied, these fields will be excluded as input variables for the model.
return_field_name String None The name of the return field within the mutation. The default is the camelCased name of the model
permissions Tuple None The permissions required to access the mutation
login_required Boolean None If true, the calling user has to be authenticated
auto_context_fields Dict None A mapping of context values into model fields. See below
optional_fields Tuple () A list of fields which explicitly should have required=False
required_fields Tuple None A list of fields which explicitly should have required=True
type_name String None If supplied, the input variable in the mutation will have its typename set to this string. This is useful when creating multiple mutations of the same type for a single model.

If there are multiple filters, these will be combined with and-clauses. For or-clauses, use multiple mutation calls.

class FilterUpdateUserMutation(DjangoFilterDeleteMutation):
    class Meta:
        model = User
        filter_fields = ('name',)
mutation {
    filterUpdateUser(filter: {name: 'John'}, data: {name: 'Ola'}){
        updateObjects{
            id
            name
        }
    }
}