# Upsert equivalent on dgraph

**URL:** <https://discuss.dgraph.io/t/upsert-equivalent-on-dgraph/10691>\
**Category:** GraphQL\
**Tags:** kind:question\
**Created:** [September 30, 2020, 9:16am UTC](https://discuss.dgraph.io/t/upsert-equivalent-on-dgraph/10691 "2020-09-30T09:16:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ArjunInventor](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/arjuninventor/32/4969_2.png) [@ArjunInventor](https://discuss.dgraph.io/u/ArjunInventor)\
**Post date:** [September 30, 2020, 9:16am UTC](https://discuss.dgraph.io/t/upsert-equivalent-on-dgraph/10691/1 "2020-09-30T09:16:47Z")

</div>

What is the equivalent of an upsert mutation (as shown here - [https://hasura.io/docs/1.0/graphql/core/mutations/upsert.html](https://hasura.io/docs/1.0/graphql/core/mutations/upsert.html)) on dgraph graphql?

I’m looking for a way to make an update mutation which should fallback to an add mutation given that the item to be updated does not exist.

---

<div class="post-metadata">

**Author:** ![rajas](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/rajas/32/4393_2.png) [@rajas](https://discuss.dgraph.io/u/rajas)\
**Post date:** [September 30, 2020, 10:08am UTC](https://discuss.dgraph.io/t/upsert-equivalent-on-dgraph/10691/2 "2020-09-30T10:08:59Z")

</div>

Hi @ArjunInventor,

Welcome to the Dgraph Community !!

Dgraph DQL does support upsert procedure using the [upsert block](https://dgraph.io/docs/mutations/upsert-block/) . To use DQL in Dgraph Graphql you may need to use [custom DQL directive](https://dgraph.io/docs/graphql/custom/graphqlpm/).

Linking a related discuss post : [How to upsert using GraphQL?](http://discuss.hypermode.com/t/how-to-upsert-using-graphql/9931)

Feel free to ask any other questions/queries which you may face while using Dgraph.
