Latest Pre-release in branch 5.1 (Rapid Release)
5.1.2-rc0
Released 17 Dec 2021
(4 years ago)
SoftwareMongoDB Server
Version5.1 (Rapid Release)
Status
End of life
Initial release5.1.0
04 Nov 2021
(4 years ago)
Latest release5.1.2-rc0
17 Dec 2021
(4 years ago)
End of life31 Jul 2021
(Ended 4 years ago)
Release noteshttps://www.mongodb.com/docs/manual/release-notes/5.1/
Documentationhttps://www.mongodb.com/docs/v5.1/
Downloadhttps://www.mongodb.com/try/download/community
MongoDB Server 5.1 (Rapid Release) ReleasesView full list

What Is New in MongoDB 5.1

MongoDB 5.1 is an incremental release packed with refinements that boost developer productivity and database performance. It builds on the foundation of 5.0 with enhancements to time series collections, sharding, and operational resilience.

Category Key Changes
New Features Sharded Time Series Collections, Compound Hashed Shard Keys, Refinable Shard Keys
Improvements Balancer & Migration Optimizations, Default Read/Write Concerns, Resharding UI
Operational Changes New Defaults for Retryable Writes, Index Build Abort Behavior

How did sharding evolve in MongoDB 5.1?

Sharding got a major boost for handling massive-scale data workloads. The headline feature is the ability to shard time series collections, which is a game-changer for IoT and analytics applications that were previously limited to a single replica set.

You can now use compound hashed shard keys, offering more flexibility in designing a shard key that distributes writes evenly. Refinable shard keys let you change your shard key strategy later without a full migration, which is huge for adapting to changing query patterns.

In practice, the balancer is now smarter. It can perform parallel chunk migrations and skip unnecessary moves if a shard is already draining, making rebalancing operations much faster and less intrusive on cluster performance.

What time series enhancements were introduced?

Time series collections are now shardable. This directly addresses the primary limitation of the initial 5.0 release, allowing these specialized collections to scale horizontally across a cluster just like any other collection.

This matters because it unlocks the potential for truly massive time-series datasets. You're no longer capped by the storage or memory of a single replica set, making MongoDB a much more compelling option for large-scale sensor data, financial tick data, or application metrics.

Were there any default behavior changes?

Yes, a few sensible defaults were updated to favor modern application resilience. The default read concern for standalone mongod instances and direct connections to a shard is now local. This ensures you read your own writes immediately, which is what most developers expect.

Similarly, the default write concern for transactions changed from w:1 to w:majority. This makes transactions safer out of the box by defaulting to acknowledging writes across a majority of replicas. Retryable writes are also now enabled by default for all supported deployment types.

How were index builds improved?

The behavior for aborting in-progress index builds was refined for safety. If you kill the operation that initiated an index build (like createIndex), the index build itself will now continue to completion in the background instead of being torn down.

This prevents a scenario where you could be left with a partially built index, which is difficult to clean up and can cause problems. It's a small change that makes database operations more robust and predictable.

FAQ

Can I shard my existing time series collections after upgrading to 5.1?
Yes, you can shard existing time series collections using the shardCollection command. The collection must have a time field and a meta field defined in its schema, and your shard key must be on the meta field, the time field, or a compound of both.

What is a refinable shard key and when would I use it?
A refinable shard key allows you to add a suffix of extra fields to an existing shard key. You'd use this when your initial shard key choice leads to jumbo chunks or hot shards later on, letting you refine the distribution without the massive effort of changing the entire key.

Is there a UI for resharding in MongoDB 5.1?
Yes, if you're using MongoDB Atlas, the resharding process is now integrated into the web UI. This provides a guided experience for changing your shard key, which is one of the most complex operations you can perform on a cluster.

Why did the default write concern for transactions change to "majority"?
This change ensures data durability by default. A transaction with w:majority won't commit until a majority of replica set members have the data, protecting it from being rolled back in the event of a primary failover. It's a safer starting point.

If I kill an index build, will it always continue now?
This new behavior applies specifically to index builds started on the primary. If you kill the client connection that issued the createIndex command, the build continues. However, you can still abort an index build using the db.killOp() method on the specific index build operation itself.

Releases In Branch 5.1 (Rapid Release)

VersionRelease date
5.1.2-rc017 Dec 2021
(4 years ago)
5.1.1-rc020 Nov 2021
(4 years ago)
5.1.120 Nov 2021
(4 years ago)
5.1.004 Nov 2021
(4 years ago)
5.1.0-rc302 Nov 2021
(4 years ago)
5.1.0-rc225 Oct 2021
(4 years ago)
5.1.0-rc118 Oct 2021
(4 years ago)
5.1.0-rc008 Oct 2021
(4 years ago)
5.1.0-alpha23 Jul 2021
(4 years ago)