MongoDB 4.2 is now generally available for production deployments. This release advances the state of the art in modern transactional and analytical data platforms. It gives you ACID guarantees and sophisticated data processing pipelines at any scale, secured by some of the industry’s most advanced encryption controls. You can run 4.2 anywhere: in your data center, in a hybrid model, and with Atlas, you get the only fully-managed, cloud-native MongoDB service available on AWS, Azure, and GCP. Download MongoDB today, or try MongoDB 4.2 in the cloud with Atlas in minutes.
MongoDB 4.2 includes many exciting new features. Here are some of the highlights:
Distributed Transactions: Support for multi-document ACID transactions is now extended to sharded clusters.
Global Point In Time Reads: Snapshot read isolation in 4.2 guarantees your apps always return a consistent view of data, even when the data is distributed across a sharded cluster, and as it is being modified by other operations.
Large Transactions: By representing transactions across multiple oplog entries, you can now write more than 16MB of data in a single ACID transaction.
Transaction Diagnostics and Error Handling: Transaction metrics are now written to system logs, helping you optimize application performance. In addition, new driver-side helpers make it easier for you to develop transaction retry logic in your app.
Mutable Shard Key Values: You can now update one or more shard key values to modify the placement of a document in a cluster using a single, all-or-nothing ACID transaction.
On-Demand Materialized Views: Results from aggregation pipeline queries can now be merged with existing persisted result sets whenever you run the pipeline, giving you materialized views that are refreshed on-demand.
Wildcard indexes: You can now define a pattern that automatically indexes matching fields, sub-documents, and arrays in a document, providing much simpler schema design for polymorphic document structures.
More Expressive Update Language: You can now use the aggregation pipeline to construct update operations based on values in other fields, with all updates performed in a single atomic operation.
New Mathematical Operators: New aggregation operators and expressions: MongoDB 4.2 adds support for new regex aggregation operators, a dozen new mathematical expressions for rounding and trigonometry, as well as current time expressions like $$NOW to reduce the amount of code you need to implement in your application tier.
New Online Index Builds: As fast as foreground builds, they don’t block service to the application.
10x Faster stepDown and Keepalive Connections: As soon as you issue a stepDown command, the MongoDB primary immediately initiates an election rather than waiting on the secondaries to call it. After the stepDown, existing read connections on the former primary are kept open, and are only re-established on the new primary once reads have completed and their associated cursors closed leading to smoother behavior during routine maintenance operations.
Storage Node Watchdog: Adding to existing network heartbeats for liveness checking, the Storage Node Watchdog can be used to monitor MongoDB’s underlying filesystems and initiate an automated failover if any of them becomes unresponsive. This allows the cluster to automatically self-heal in the face of a wider range of failure conditions.
Faster Initial Sync: You can now add new nodes to a replica set 15% faster, while also reducing load on the source replica.
Zstandard Compression: MongoDB 4.2 adds support for Zstandard compression, providing up to 55% storage savings compared to snappy, with lower CPU overhead than Zlib.
Field level encryption (beta)
Client-side Field Level Encryption (FLE) was also announced as part of MongoDB 4.2. With FLE you can selectively protect sensitive fields within documents, each encrypted with its own key and decrypted seamlessly on the client. At this time, driver support for FLE is in beta status, so you should not use FLE in production.
Improved Auditing Performance: We’ve refactored internal locking within the Auditing plugin, resulting in a 3x performance improvement.
Multi-Certificate Authority and Forward Secrecy TLS Encryption: Separate Certificate Authorities can now be configured for inbound and outbound encrypted connections to a MongoDB Atlas cluster. In-flight encryption also now supports the latest TLS cipher suites offering Forward Secrecy.
Zero Downtime Certificate and Keyfile Rotation: You can now change your keyfiles and X.509 certificates without having to take down your cluster.
For more information about MongoDB 4.2, please see the following resources:
Get up to speed on MongoDB with the MongoDB 4.2 Online Course
Review the MongoDB 4.2 Release Notes
Try MongoDB 4.2 in Atlas in minutes
Last but not least, we would like to acknowledge the following community members who have contributed to this release: Aaron Queen, Adun, Alexander Abolishin, Alexey Eremenko, Alexey Rogulin, Amirouche, Andrada Nastasie, Artem, Brendan Turner, Caleb Hankins, Caleb Webber, CenZheng, Cesar, Cezary Bartosiak, Chad Kreimendahl, Chibuikem Amaechi, Connecting Media, Dan Dascalescu, Daniel Stewart, David Bartley, David Schuppner, Dmitri Shubin, Dugast Fabien, Elan Kugelmass, Georgi Chochov, Gilad Peleg, Gregory Banks, Hieu Phan Trong, hydrapolic, Igor Solodovnikov, Ivica Hrg, Jacky Lee, Jakub Szypulka, Jared D. Cottrell, Jonas Gustavsson, Jongwon Kim, Kamil Dziedzic, lipengchong, Łukasz Walukiewicz, Marek Skalický, Mark Callaghan, Matt SeongUck Lee, McKittrick Swindle, Michael Gmelin, Mitar, Miłosz Suchy, Moditha, Mouhcine, O, Ori Avtalion, PARK-MinSoo, Pavel Odintsov, QuellaZhang, Remi Jolin, Rodrigo Nascimento, Ryan Schmidt, Sam Tolmay, Travis Brown, William Deegan, yxyxz123456. Thank you!
Please continue sending us your feedback!
The MongoDB Team