Mutations

GraphQL mutations are used to modify server-side data i.e. write, update or delete data. As with queries, mutation fields are auto-generated on the Postgres schema. Here’s a sample mutation field from our reference Authors/Articles schema:

insert_article(
  objects: [article_input!]
  on_conflict: conflict_clause
  ): article_mutation_response

As you can see from the schema, you can:

  1. Pass multiple objects to the mutation.
  2. Return objects, from the affected rows, in the response.

Note

As of now you cannot return a nested object in the mutation response (we are working on this feature).

Let’s use this reference Authors/Articles schema to look at different types of mutations.