mgo

Comment 2 for bug 1403846

Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

This behavior is in line with the intended semantics: asserts fail with ErrAborted, always, and the fact a document is not present will not abort a transaction without an assertion. This behavior may be leveraged to implement useful semantics, although I do understand your desire to know exactly how a transaction failed. Unfortunately, there's a trade-off against consistency and simplicity in this case, and I'd rather not make the transaction package any more complex than it already is.

You can easily implement that on your side, though: once a transaction is aborted, just read the document _id to see if it is there. Of course, that might not be the real state of the document when the transaction was attempted, but this will be true either way if you consider the document non-existent (it may have been created since the transaction finished as well, for example).