Hi,
I’m try to use official javascript client for dGraph.
How can I read response data from mutation? I would like to read assigned uids for new nodes.
Thank you.
Hi,
I’m try to use official javascript client for dGraph.
How can I read response data from mutation? I would like to read assigned uids for new nodes.
Thank you.
Assuming you are using gRPC.
const serialized = new Uint8Array(new Buffer(json));
const mu = new dgraph.Mutation();
mu.setSetJson(serialized);
return txn.mutate(mu).then((res) => {
txn.commit();
console.log(res.getUidsMap().get("blank-0")) . => Like so you can retrieve the UIDs returned from a mutation.
return;
}).catch((e) => {
console.log(e);
return txn.discard();
});
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.