Mongo Transactions

database mongodb nosql October 5, 2021

In older versions of MongoDB, transactions were limited to single documents: updates on single documents were atomic, and as they could hold references to other documents (or be quite in-depth themselves), transactions were somewhat avoidable.

However, in later versions of Mongo, multiple updates can be made transactional, allowing users to coordinate updates just as they might in a traditional SQL database.

However, this is a per-API feature, so you’d want to open up the reference material for Transactions and select the language of choice, to see how the MongoDB API represents transactions for each specific language.

It’s not spectacularly simple - certainly nothing like the BEGIN TRANSACTION semantics offered by SQL databases - but it’s doable and welcome.

in mongodb nosql big data java javascript python go

Reading time: 1 minute.