Unpacking the Latest Features and Enhancements of MongoDB 7.0
Tags: mongodb, nosql
Published: 2023-08-23 11:52:13

---
title: Unpacking the Latest Features and Enhancements of MongoDB 7.0
published: true
date: 2023-08-19 06:03:51 UTC
tags: mongodb, nosql
canonical_url: https://blog.amanpreet.dev/latest-features-of-mongodb-7
---
![MongoDB 7.0](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6845513w9dkqt7qlwk9r.png)

## 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](https://dev.to/amanpreet-dev/mastering-mongodb-top-5-essential-aggregation-pipelines-1pdn)

### 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> } )

```

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

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

```

### 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](https://www.mongodb.com/docs/atlas/images/fts-architecture.png)

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](https://webimages.mongodb.com/_com_assets/cms/llcnxjsr478znmlnr-ezgif.com-optimize.gif)

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](https://www.mongodb.com/docs/v7.0/release-notes/7.0-upgrade-standalone/#std-label-7.0-upgrade-standalone)

If you are trying to install the latest version of MongoDB, visit this [link](https://www.mongodb.com/try/download/community)

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**](https://dev.to/amanpreet-dev) to read more exciting articles. You can check my social links [**here**](https://linkfree.io/amanpreet-dev).

## References

[MongoDB Docs](https://mongodb.com/docs/)

[Release Notes for MongoDB](https://www.mongodb.com/docs/v7.0/release-notes/7.0/)

[Queryable Encryption](https://www.mongodb.com/blog/post/mongodb-announces-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.