How do we do upsert?

Posted by srikoushik:

I want to do a query and update a particular predicate.

paulftw commented :

Here’s an older example of upserts: dgraph-js-http/acctUpsert.spec.ts at b14381cb9a21b7379d996d67cc05665aaea52d94 · dgraph-io/dgraph-js-http · GitHub

For questions please use our forums at

paulftw commented :

Most modern way to do upsert is using upsert block:

Ratel sends upsert mutations this way:
client.newTxn().mutate({ mutation: upsertBlockMutation, commitNow: true });