Docs Home → Develop Applications → MongoDB Manual
Release Notes for MongoDB 5.1![](/docs/v5.2/assets/link.svg)
On this page
Note
MongoDB 5.1 Released November 9, 2021
Patch Releases![](/docs/v5.2/assets/link.svg)
5.1.2 - Upcoming![](/docs/v5.2/assets/link.svg)
Issues fixed:
SERVER-61839 $elemMatch w/ positional $ project SBE bug
SERVER-61427 Unique index builds can cause a loss of availability during commit due to checking many false duplicates
SERVER-61194 Prevent time-series bucket OID reuse with coarse granularity
SERVER-60310 OCSP response validation should not consider statuses of irrelevant certificates
SERVER-56227 Add user-facing command to set allowMigrations to false for a sharded collection
5.1.1 - December 9, 2021![](/docs/v5.2/assets/link.svg)
Issues fixed:
SERVER-61633 Resharding's RecipientStateMachine doesn't join thread pool for ReshardingOplogFetcher, leading to server crash at shutdown
SERVER-61483 Resharding coordinator fails to recover abort decision on step-up, attempts to commit operation as success, leading to data inconsistency
SERVER-61482 Updates to config.reshardingOperations wait for PrimaryOnlyService to be rebuilt while holding oplog slot, stalling replication on config server indefinitely
SERVER-61304 Unable to use --use-system-{pcre,boost,...} with r5.1.0
SERVER-51329 Unexpected non-retryable error when shutting down a mongos server
Aggregation![](/docs/v5.2/assets/link.svg)
New Aggregation Stages![](/docs/v5.2/assets/link.svg)
MongoDB 5.1 introduces the following aggregation stages:
Stage | Description |
---|---|
Creates new documents in a sequence of documents where values in
a specified field are missing. | |
Returns literal documents from input expressions. |
New Aggregation Operators![](/docs/v5.2/assets/link.svg)
MongoDB 5.1 introduces the following aggregation operators:
$geoNear accepts let-bound
variables![](/docs/v5.2/assets/link.svg)
Starting in MongoDB 5.1, the near
parameter in the $geoNear
aggregation stage supports the let option and
bound let option.
$lookup and $graphLookup with sharded collections![](/docs/v5.2/assets/link.svg)
Starting in MongoDB 5.1,
the $lookup
and $graphLookup
aggregation stages
support sharded collections in the from
parameter.
In previous versions of MongoDB, $lookup
and $graphLookup
only allowed for unsharded from
collections.
General Aggregation Improvements![](/docs/v5.2/assets/link.svg)
Starting in MongoDB 5.1, $dateSubtract
and
$dateAdd
report an error when an overflow is detected for
amount
values.
Time Series Collections![](/docs/v5.2/assets/link.svg)
Geo Indexing for Time Series collections![](/docs/v5.2/assets/link.svg)
Starting in MongoDB 5.1, you can use geo indexes on the metaField
of time
series collections.
Updates and Deletes![](/docs/v5.2/assets/link.svg)
Starting in MongoDB 5.1, time series collections support update and delete operations with limitations.
Sharded Time Series Collections![](/docs/v5.2/assets/link.svg)
MongoDB 5.1 provides support for sharded time series collections.
See:
Slot-Based Query Execution Engine![](/docs/v5.2/assets/link.svg)
Starting in MongoDB 5.1, a new query execution engine is used for eligible queries. If the slot based query execution engine is used, new fields are included in the query explain plan output.
The new query execution engine is used if possible.
If the new query execution engine is used, new fields are included in the query explain plan output.
Set Slot-Based Query Execution Plan Cache Size![](/docs/v5.2/assets/link.svg)
You can set the size of the plan cache for the new query engine with the
planCacheSize
parameter.
Increasing the plan cache size adds more cached query shapes for the query planner. This can improve query performance, but increases memory usage.
Change Streams![](/docs/v5.2/assets/link.svg)
Starting in MongoDB 5.1, change streams are optimized, providing more efficient resource utilization and faster execution of some aggregation pipeline stages.
Indexes![](/docs/v5.2/assets/link.svg)
Starting in MongoDB 5.1, you can use the collMod
database
command to add the expireAfterSeconds
option to an existing
single-field non-TTL index.
Platform Support![](/docs/v5.2/assets/link.svg)
Starting in MongoDB 5.1.2 the following platforms are no longer supported.
Community Edition![](/docs/v5.2/assets/link.svg)
RHEL-72-s390x
General Improvements![](/docs/v5.2/assets/link.svg)
Metadata Option Added for validate
Command![](/docs/v5.2/assets/link.svg)
Starting in MongoDB 5.1 (and MongoDB 5.0.4), the validate
command and the db.collection.validate()
helper method have a
new metadata option that quickly
validates collections and detects invalid index options.
serverStatus
Output Change![](/docs/v5.2/assets/link.svg)
serverStatus
includes the following new fields in its
output:
- Aggregation Metrics
metrics.operatorCounters.match
A document which indicates how often match expressions ran.
- Opcode Counters
opcounters.deprecated
A count of how often deprecated opcodes run.
- Resharding Statistics
Extra Logging Fields for Slow Queries with getMore
Command![](/docs/v5.2/assets/link.svg)
Starting in MongoDB 5.1, when a getMore
command is logged
as a slow query, the queryHash and planCacheKey fields are added
to the slow query log message and the
profiler log message.
Schema Validation Errors Contain Description Field![](/docs/v5.2/assets/link.svg)
Starting in MongoDB 5.1, when a document fails schema validation, MongoDB includes the validation title
and description
in the error response. You can use these fields to
provide a clearer explanation of the validation when the rules
are not immediately clear, such as when using regular expressions.
For an example, see Use Title and Description Fields to Clarify Validation Rules.
Replica Sets![](/docs/v5.2/assets/link.svg)
Assert Cluster Wide Write Concern is Set When Starting or Adding Shard![](/docs/v5.2/assets/link.svg)
Starting in MongoDB 5.1, when starting, restarting or adding a
shard server with sh.addShard()
the
Cluster Wide Write Concern (CWWC)
must be set.
If the CWWC
is not set and the shard is configured
such that the default write concern is
{ w : 1 }
the shard server will fail to start or be added
and returns an error.
See default write concern calculations for details on how the default write concern is calculated.
rs.reconfig
Cluster Wide Write Concern Validation![](/docs/v5.2/assets/link.svg)
Starting in MongoDB 5.1, you must set the
Cluster Wide Write Concern (CWWC)
prior to issuing any reconfigs
that would otherwise change the
default write concern of the new
replica set member.
storeFindAndModifyImagesInSideCollection
Parameter![](/docs/v5.2/assets/link.svg)
Starting in MongoDB 5.1, the
storeFindAndModifyImagesInSideCollection
parameter
determines whether the temporary documents required for retryable findAndModify
commands are stored in
the side collection (config.image_collection
).
Sharded Clusters![](/docs/v5.2/assets/link.svg)
mongod
Sharded Cluster And Config Server Changes![](/docs/v5.2/assets/link.svg)
Starting in MongoDB 5.1, when starting a mongod
with the
--configsvr
option you must also
specify a --replSet
.
Starting in MongoDB 5.1, when starting a mongod
with the
--shardsvr
option you must also
specify a --replSet
.
Security![](/docs/v5.2/assets/link.svg)
SELinux![](/docs/v5.2/assets/link.svg)
Starting in MongoDB 5.1, there is a new SE Linux Policy for:
MongoDB Enterprise Server
MongoDB Community Edition Server
running on Red Hat Linux. The SELinux policy is for use with default
installations using rpm
installer packages.
Report an Issue![](/docs/v5.2/assets/link.svg)
To report an issue, see https://github.com/mongodb/mongo/wiki/Submit-Bug-Reports for instructions on how to file a JIRA ticket for the MongoDB server or one of the related projects.