Bulk delete todos - mutation

In this part of the tutorial, you will learn how to bulk delete all the existing completed todos by using GraphQL Mutations.

Let's define a graphql query to do a mutation into todos.

mutation clearCompleted {
delete_todos(where: {is_completed: {_eq: true}, is_public: {_eq: false}}) {
affected_rows
}
}

You will also need to pass in the values for the variables.

Try this mutation in GraphiQL against the application database to see what the response looks like.

Let's now integrate this graphql mutation into our app.

Close

Get Started with GraphQL Now

Hasura Cloud gives you a fully managed, production ready GraphQL API as a service to help you build modern apps faster.
Ready to get started?
Start for free on Hasura Cloud or you could contact our sales team for a detailed walk-through on how Hasura may benefit your business.
Stay in the know
Sign up for full access to our community highlights, new features, and occasional baby animal gifs! Oh, and we have a strict no-spam rule. ✌️