blog

What’s new in MongoDB 6

Zamani Rahman

Published

Hand holding a plant with sprouting leaves, a play on the MongoDB leaf logo

MongoDB 6.0 is a major release by MongoDB launched in July 2022. In the release, MongoDB introduced a bunch of new features and improvements aimed at removing complexity – so that users don’t have to troubleshoot as often, and can ultimately build at a faster pace.

You will find full support for the release in ClusterControl, as of version 1.9.7.

Here, we will highlight seven new features in MongoDB 6.0 that add value for anyone using this particular database flavor.

Let’s dive in.

1. Extra support for time series data

Time series data is used across diverse industries, including finance, IoT, and telecommunications. With the way that modern applications have evolved, this type of data has become increasingly crucial.

In the last major release (MongoDB 5.0), the introduction of time series data meant that you could properly collect, process, and analyze it for access to new insights. The 5.0 release also overcame issues like high volume, storage and cost concerns, and gaps in data continuity.

Support for time series data is extended in MongoDB 6.0, where secondary and compound indexes have been introduced for measurement – consequently increasing the read performance.

With this, MongoDB has opened up the potential for geo-indexing.

Geo-indexing allows you to enrich and broaden your analysis, since scenarios involving distance and location can now be included as well.

Apart from that, both query performance and sort operations also have been improved since the data point in series now can be efficiently produced without needing to scan the entire collection.

2. Improved change streams

Modern applications like Waze or Uber rely on event-driven architectures to handle real-time data such as activity feeds and notifications. They also need recommendation engines to provide seamless user experiences.

In these instances, the data will keep changing and requires the application to identify modifications in a short amount of time.

This is where the change streams feature introduced in MongoDB 3.6 comes into action. Change streams allow an API to stream any modifications to a MongoDB database, cluster, or collection without jeopardizing the performance.

MongoDB 6.0 has added new abilities to improve the way you can work with change streams.

For example, you can get the before and after the state of a document that’s modified, which allows you to send revised versions of entire documents downstream, reference deleted documents, and so on.

Additionally, change streams in 6.0 now support data definition language (DDL) operations, such as creating or dropping collections and indexes.

The outcome? More responsive, scalable, and dynamic applications that align with user expectations.

3. Deeper insights and faster queries

Querying data is an essential element of database management. In MongoDB 6.0, MongoDB enhances the querying capabilities by introducing two key operators, $lookup and $graphlookup, improving JOINS and graph traversals.

Now you can get full support for sharded deployments from both $lookup and $graphlookup in addition to the performance upgrade of $lookup.

For example, if a larger number of documents are matched, $lookup performance will be twice as fast as the previous version.

You can actually get results between five and ten times faster than previous iterations if you have a scenario where there is an index on the foreign key and a small number of documents have been matched.

MongoDB 6.0 now allows your applications to perform complicated analytical queries against a globally and transactionally consistent snapshot of your live, operational data. This is through the introduction of read concern snapshot and the optional atClusterTime parameter. With these features, the consistency of the query results returned to the users is well-conserved.

4. Additional operators for automation

Without a doubt, productivity is a number one priority for any development team. With MongoDB 6.0, you can now locate vital values in the data set with the introduction of an array of new operators like $maxN , $minN , or $lastN. In the event that you need to sort elements in an array directly in your aggregation pipelines, $sortArray operator can be leveraged to come in handy.

With these new operators, you spend less time manipulating the data manually and writing code. The new operators will automate essential commands and long lines of code.

As a result, you should see a productivity boost and have more time to concentrate on other assignments.

5. Upgrades for initial sync and sharding

Downtime is a nightmare for businesses, and database maintenance can be a significant contributor. This is one of the reasons why MongoDB introduced initial sync via file copy in MongoDB 6.0, which is up to four times faster than previously available methods.

It’s worth noting that this feature is only available with MongoDB Enterprise Server. 

On a side note, ClusterControl also supports MongoDB Enterprise clusters.

Besides initial sync via file copy, MongoDB 6.0 also introduces significant improvements to sharding, the mechanism that facilitates horizontal scalability.

The default chunk size for sharded collections has been increased to 128 MB. The benefit is that you will have lower chunk migrations and higher efficiency from both a networking standpoint and internal overhead at the query routing layer.

In addition, to reduce the impact of the sharding balancer, a new configureCollectionBalancing command has been introduced, allowing the defragmentation of a collection.

6. New options for data security and operational efficiency

Security and operational efficiency are critical considerations for any organization. MongoDB 6.0 introduces enhancements like extended support for KMIP-compliant key management providers for Client-Side Field-Level Encryption (CSFLE) which has been introduced since its launch in 2019.

This standardization streamlines cryptographic objects like encryption keys, certificates, and more while extending the efficiency of securing sensitive data.

Additionally, the version’s encrypted audit events reinforce accountability, providing the confidentiality and integrity of logs, even when shared with central log management systems or SIEM.

Announced at MongoDB World 2022, Queryable Encryption – a groundbreaking feature is now available in preview. Queryable Encryption enables powerful queries on encrypted data while maintaining encryption until it is made available to the user.

This introduces a paradigm shift, allowing efficient data querying without the need for prior decryption, thus providing data security throughout its lifecycle.

Wrapping up

MongoDB 6.0’s new features and improvements focus on optimizing development and operations, eliminating data silos, and simplifying complex architectures. This ultimately fosters a more productive environment for innovation and creation.

The version adds a lot of value for anyone already using MongoDB, as well as anyone curious to test the technology.

ClusterControl provides full lifecycle support for both MongoDB 6.0 and the MongoDB enterprise binary, which you can try in a sandbox demo of the platform.

Stay on top of all things MongoDB by subscribing to our newsletter below.

Follow us on LinkedIn and Twitter for more great content in the coming weeks. Stay tuned!

Subscribe below to be notified of fresh posts