Moved from GitHub dgraph-js/113
Posted by benwerner01:
I’m trying to run multiple mutations in the same transaction. To my understanding something like this should work:
runMutations = async (mutations: DGraphJS.Mutation[]): Promise<DGraphJS.Response> => {
const txn = this.client.newTxn();
try {
const req = new DGraphJS.Request();
req.setCommitNow(true);
req.setMutationsList(mutations);
return txn.doRequest(req);
} finally {
await txn.discard();
}
}
However this throws the following error:
StartTs cannot be zero while committing a transaction
What’s weird to me is all of the mutations work when using this function. Is this error a bug, or am I doing something wrong?