Add Mutations
Add mutations allows you to add new objects of a particular type. Dgraph automatically generates input and return types in the schema for the add mutation
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.
Add mutations allow you to add new objects of a particular type.
We use the following schema to demonstrate some examples.
Schema:
Dgraph automatically generates input and return types in the schema for the
add
mutation, as shown below:
Example: add mutation on single type with embedded value
Example: add mutation on single type using variables
Variables:
You can convert an add
mutation to an upsert
mutation by setting the value
of the input variable upsert
to true
. For more information, see Upsert
Mutations.
Examples
You can refer to the following link for more examples.
Was this page helpful?