We’re overhauling Dgraph’s docs to make them clearer and more approachable. If
you notice any issues during this transition or have suggestions, please
let us know.
Input objects
Mutations require input data, such as the data, to create a new object or an object’s ID to delete. Dgraph auto-generates the input object type for every type in the schema.Return fields
Each mutation provides a set of fields that can be returned in the response. Dgraph auto-generates the return payload object type for every type in the schema.Multiple fields in mutations
A mutation can contain multiple fields, just like a query. While query fields are executed in parallel, mutation fields run in series, one after the other. This means that if we send twoupdateAuthor
mutations in one request, the
first is guaranteed to finish before the second begins. This ensures that we
don’t end up with a race condition with ourselves. If one of the mutations is
aborted due error like transaction conflict, we continue performing the next
mutations.
Example: mutation on multiple types
Union mutations
Mutations can be used to add a node to aunion
field in a type.
For the following schema,
members
to the Home
type: