MongoDB recently announced the latest version 4.0 of the popular NoSQL database. Undoubtedly, the major feature of this announcement is the support for multi-document ACID transactions.
Taking a big step towards converging with relational database products, MongoDB supports the concept of a session in which database operations can reference and use the supporting methods start_transaction() and commit_transaction() to wrap multiple database commands into a single MongoDB transaction.
MongoDB's transactions follow the well known ACID model. Atomicity makes sure that the set of commands that belong to a transaction will either be fully completed or not at all. There will never be any leftover or partial data. Consistency refers to the property that the database will always be transitioning from one valid state to the next valid state, never being left in an invalid state. Isolation guarantees that multiple transactions can execute at the same time, without any one of them being able to view partial results of the others. Executing multiple transactions at the same time has the same end result as executing them sequentially. Durability guarantees that a transaction that has committed will remain persistent, even in the case of a system failure.
MongoDB's multi document transactions are only available for servers using the WiredTiger storage engine and currently restricted to a single replica set, with support for sharded clusters coming up in version 4.2.
Multi document transactions come with some limitations, such as not being able to affect the database catalog (i.e. affect or list indexes and collections), and not being able to issue commands that fall outside the CRUD and information listing space.
These transactions can only use readPreference primary and readConcern snapshot, local or majority. Read preference inside a transaction overrides any read preference set in collection, database and client level.
Query cursors are isolated in a transaction, meaning that, for example, a getMore operation inside a transaction can only be used inside; and an outside getMore can only be used outside of the transaction. MongoDB has published an extensive list of commands limitations and support regarding transactions.
MongoDB Stitch, the serverless platform by MongoDB for rapid development of client based applications that can securely access MongoDB services is now publicly available. MongoDB Stitch offers JavaScript functions to provide serverless functionality and QueryAnywhere to allow client side code to securely query MongoDB servers from web or mobile applications. Triggers can launch methods in response to database changes, similar to RDBMS triggers. Mobile Sync which will be launched in the near future will allow for automatic data synchronization between MongoDB servers and a mobile client, using MongoDB mobile, which has announced in beta.
Version 4.0 of MongoDB introduces type conversions between double, string, objectId, boolean, date, integer, long and decimal types using the aggregation pipeline. This allows for enhanced data transformation in-database and less reliance on ETL processes.
Also announced in beta, the MongoDB Enterprise Kubernetes Operator which enables easy deployment and operation of MongoDB within a Kubernetes cluster, while leveraging the capabilities of MongoDB Ops Manager. Developers can either download the new version or try it online using the MongoDB Atlas service.