Moved from GitHub dgraph-js/21
Posted by jeffkhull:
I am trying to write a transaction which deletes from a predicate of type [string], writes back to that same predicate, and then commits both at once.
I have found I’m not able to do that with the library currently. What happens is, the original edge is deleted, but the subsequent one is never written. As an example, I am trying to perform these mutations:
const txn = client.newTxn() const mu1 = new dgraph.Mutation() mu1.setDelNquads(`<0x11194> <property.code> * .`) txn.mutate(mu1) const mu2 = new dgraph.Mutation() mu2.setSetNquads(`<0x11194> <property.code> "LDG" .`) txn.mutate(mu2) txn.commit()
If I create and commit two separate transactions rather than bundling, the written triple is visible. But if I keep it within one transaction, the result is no data left on the predicate.
Am I using the library correctly?