What’s New in MongoDB 5.x?

With the MongoDB 5.0 release, MongoDB announced a new, dual-track release system.

The major release track includes only the “.0” releases. These will be released yearly and on all platforms. The “rapid release” track allows users to upgrade to the “point” releases, such as 5.2. However, the rapid releases are only certified on MongoDB’s Atlas cloud platform (although non-certified development releases may be downloaded to on-premise deployments).

The two-tier release strategy has both practical and marketing benefits for the MongoDB company. As a practical matter, by certifying only on Atlas, MongoDB reduces the quality assurance overhead for each rapid release. From a marketing standpoint, MongoDB wants to maximize the number of customers who transition to the profitable Atlas platform. By adding goodies to Atlas first, they encourage us to move to Atlas.

The rapid releases include many useful enhancements, albeit not typically the stuff of major marketing campaigns. Let’s go through some of the things that have made it into the first three rapid releases of the 5.x line—5.1, 5.2, and 5.3.

MongoDB 5.0 introduced powerful and useful windowing capabilities within the aggregation framework. As discussed in previous columns, windowing functions operate on a “window” of documents around the current document, allowing you to access trends or group information. The windowing functions were coupled with new time-series collections that are optimized for storing data ingested in a temporal order.

Since the initial release of Windowing functions, MongoDB has added new $top and $bottom operators that give you quick access to the highest and lowest elements within a sorted list. $maxN and $min provide a similar capability: you can retrieve the top “N” elements in a sorted list. The Furthermore $fill, $linearFill, $densify operators allow you to deal with missing values ​​in time-series data, such as inserting an average or constant when an observation is missing.

Time-series collections have also been subject to some critical enhancements. Time-series collections can now be sharded, and documents can be updated or deleted in a time-series collection. Geo-indexes can now also be created on time-series data.

Another longstanding restriction on sharded systems has also been removed. MongoDB implemented joins and graph lookups way back in MongoDB 3.4 and 3.6 releases. However, until now, these operations could not be applied to sharded collections. By allowing the $lookup and $graphlookup operators to work on sharded collections, MongoDB has removed a significant limitation of sharded clusters.

5.3 also introduced clustered collections. In a normal collection, data is stored on disk roughly in the order it is inserted. This storage scheme is sometimes called “heap” storage in database terminology. In a clustered collection, data is stored in the order of the keys in the associated clustered index. Indeed, the collections documents serve as the leaf node for the B-tree that comprises the clustered index. The table and the index are inseparable. Clustered collections can be slower to consume writes but are far more performant when analytic queries that require data in the clustered order are issued.

MongoDB’s recent enhancements are definitely of the perfect variety—broadly improving on the initial implementations of new features of 5.0. However, they go a long way toward enhancing the capabilities of 5.0 and creating a significant advantage for users of the MongoDB Atlas cloud. On-premise users will have to wait for this year’s MongoDB 6.0 release.

Leave a Comment