DEV Community

Amanpreet Singh
Amanpreet Singh

Posted on • Originally published at blog.amanpreet.dev on

Unpacking the Latest Features and Enhancements of MongoDB 7.0

MongoDB 7.0

Introduction

The recent release of MongoDB 7.0 continues this tradition of innovation, introducing a series of enhancements that promise to revolutionize the way developers interact with their data.

Whether you are a seasoned MongoDB user or exploring it for the first time, the latest version offers exciting opportunities to take your development to the next level.

MongoDB has found its way into various industry applications, from large-scale e-commerce platforms, Stream Processing, Transactional, and Analytical to intricate Internet of Things (IoT) networks.

What's new in MongoDB 7.0?

New Aggregations Operators

MongoDB 7.0 brings two new aggregation operators $median and $percentile

  • $median : In a dataset, the median is the percentile value where 50% of the data falls at or below that value.

  • $percentile : In a dataset, a given percentile is a value where that percentage of the data falls at or below that value.

If you are looking to learn more about aggregations, you can check this article with sample datasets top 5 essential aggregations of MongoDB

Time Series Collections

Time series data is a sequence of data points, typically measures at successive points in time. for e.g. stock prices, temperature readings.

Time series collections in MongoDB are specifically designed to handle time series data. These are optimized for storing, querying, and processing timestamped data.

Time series collections were first introduced in version 5.0 of MongoDB and were having some limitations. The new MongoDB version 7.0 removes most of the time series limitations that were based on the $delete command.

Together with this, it also brings significant improvements to working with time series data which results in improved storage and query performance.

Compound Wildcard Indexes

MongoDB 7.0 supports creating wildcard indexes on a field or a set of fields. A compound wildcard index has one wildcard term and one or more additional index terms.

To create a wildcard index on a single field use the following syntax:

db.collection.createIndex( { "<field>.$**": <sortOrder> } )

Enter fullscreen mode Exit fullscreen mode

To create a wildcard index on all fields excluding _id we can use the following syntax:

db.<collection>.createIndex( { "$**": <sortOrder> } )

Enter fullscreen mode Exit fullscreen mode

Atlas Search Index Management

MongoDB's Atlas Search feature allows fine-grained text indexing and querying of data. This feature is only available on Atlas Clusters.

Atlas Search architecture

Atlas Search index is a data structure that categorizes data in an easily searchable format. In simple words, it is the mapping between terms and documents that contain these terms.

In MongoDB 7.0 we can now manage Atlas Search Indexes with mongosh methods and database commands.

Large Change Stream Events

Change Streams allow applications to access real-time data changes without complexity and risk of tailing the operation log i.e oplog.

Change Streams can be beneficial for reliable business systems architectures, informing downstream systems once data changes are durable.

In the new version of MongoDB, if you have change stream events larger than 16MB, we can use the new $changeStreamSplitLargeEvent stage to split events into smaller fragments.

Security

Starting in MongoDB 7.0, security capabilities have been strengthened by making general availability of Queryable Encryption.

Queryable Encryption offers end-to-end encryption of sensitive data while preserving the ability to run equality queries on that encrypted data.

Working Model of Queryable Encryption:

Gif displaying how queryable encryption works

The latest version of MongoDB Enterprise version supports OIDC i.e. OpenID connect authentication.

Upgrading to MongoDB 7.0

To upgrade a standalone from a previous major release, kindly follow the guidelines mentioned here

If you are trying to install the latest version of MongoDB, visit this link

At the time of writing this article, MongoDB 7.0 was not available via Docker Hub but should be available in near time.

Conclusion

With a full set of new features, security improvements, and other enhancements, MongoDB 7.0 is the perfect choice for organizations to take their development to the next level.

I hope you have learned something new as I did. If so, kindly like and share the article and also follow me to read more exciting articles. You can check my social links here.

References

MongoDB Docs

Release Notes for MongoDB

Queryable Encryption

General Acknowledgment

The images used to describe the Atlas Search Index and Model of Queryable Encryption have been taken from the MongoDB website and are owned by MongoDB Inc.

Top comments (0)