How to upsert using GraphQL?

This was one of the reasons the developers of Dgraph needed to invent DQL (GraphQL±) you can read more about that at:

To answer your question directly,

You will have to do it in 2 or more queries/mutations with a client side script.

Ah, the downside of using DQL and GQL together. With DQL you have to define every single predicate and the GQL equivalent reverse predicate. Do if you are changing the author on a Post you would need to set both Post.author and Author.hasPosts to make it a full update. GQL generates alot of these extra steps needed in DQL for you making it easier, but again that has limitations as you are now aware.

1 Like