Dgraph-js get mutation result from transaction

I’m happily able to perform mutations through dgraph-js, but I’d like to get the response after adding a new node (in particular the generated uid). Where and how am I supposed to do this?

        const txn = this.dgraphClient.newTxn();
        try {
            const mu: Mutation = new dgraph.Mutation();
            mu.setSetJson(data);
            await txn.mutate(mu);
            await txn.commit();
            console.log(txn);
        } catch(e) {
            console.log(e);
        } finally {
            await txn.discard();
        }

Hey, try
getUidsMap()

update: Here a example

Other example

1 Like

Oh my god how did I miss that? I think I need some sleep. Thanks again michel

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.