Skip to content

Cannot use same transaction for delete and set mutations #21

@cyphercider

Description

@cyphercider

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?

Metadata

Metadata

Assignees

Labels

kind/bugSomething is broken.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions