Docs Menu

Docs HomeDevelop ApplicationsMongoDB Manual

Release Notes for MongoDB 5.1

On this page

  • Patch Releases
  • Aggregation
  • Time Series Collections
  • Slot-Based Query Execution Engine
  • Change Streams
  • Indexes
  • Platform Support
  • General Improvements
  • Replica Sets
  • Sharded Clusters
  • Security
  • Report an Issue

Note

MongoDB 5.1 Released November 9, 2021

Issues fixed:

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.

MongoDB 5.1 introduces the following aggregation operators:

Operator
Description

Returns the seconds from a timestamp as a long.

Returns the incrementing ordinal from a timestamp as a long.

Starting in MongoDB 5.1, the near parameter in the $geoNear aggregation stage supports the let option and bound let option.

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.

Starting in MongoDB 5.1, $dateSubtract and $dateAdd report an error when an overflow is detected for amount values.

Starting in MongoDB 5.1, you can use geo indexes on the metaField of time series collections.

Starting in MongoDB 5.1, time series collections support update and delete operations with limitations.

MongoDB 5.1 provides support for sharded time series collections.

See:

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.

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.

Starting in MongoDB 5.1, change streams are optimized, providing more efficient resource utilization and faster execution of some aggregation pipeline stages.

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.

Starting in MongoDB 5.1.2 the following platforms are no longer supported.

  • RHEL-72-s390x

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 includes the following new fields in its output:

Aggregation Metrics
Opcode Counters
Resharding Statistics

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.

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.

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.

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.

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).

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.

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.

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.

←  Compatibility Changes in MongoDB 5.2Compatibility Changes in MongoDB 5.1 →