Release Notes for MongoDB 5.1

On this page本页内容

Important重要的

MongoDB 5.1 is a rapid release and is only supported for MongoDB Atlas. MongoDB 5.1是一个快速版本,只支持MongoDB Atlas。MongoDB 5.1 is not supported for use on-premises. MongoDB 5.1不支持在本地使用。For more information, see MongoDB Versioning.有关更多信息,请参阅MongoDB版本控制

Note注意

MongoDB 5.1 Released November 9, 2021MunGDB 5.1发布于2021年11月9日

Patch Releases补丁发布

5.1.2 - Upcoming

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 certificatesOCSP响应验证不应考虑不相关证书的状态
  • SERVER-56227 Add user-facing command to set allowMigrations to false for a sharded collection添加面向用户的命令,将碎片集合的allowMigrations设置为false
  • All JIRA issues closed in 5.1.2所有JIRA问题都在5.1.2中解决
  • 5.1.2 Changelog

5.1.1 - December 9, 2021

Issues fixed:

  • SERVER-61633 Resharding's RecipientStateMachine doesn't join thread pool for ReshardingOplogFetcher, leading to server crash at shutdownResharding的RecipientStateMachine没有加入ReshardingPlogFetcher的线程池,导致服务器在关闭时崩溃
  • SERVER-61483 Resharding coordinator fails to recover abort decision on step-up, attempts to commit operation as success, leading to data inconsistencyResharding coordinator无法恢复升级时的中止决定,尝试将操作提交为成功,导致数据不一致
  • SERVER-61482 Updates to config.reshardingOperations wait for PrimaryOnlyService to be rebuilt while holding oplog slot, stalling replication on config server indefinitely对configreshardingOperations的更新将等待PrimaryOnlyService重新生成,同时保留oplog插槽,从而无限期地暂停config server上的复制
  • 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关闭mongos服务器时出现意外的不可重试错误
  • All JIRA issues closed in 5.1.1
  • 5.1.1 Changelog

Aggregation聚合

New Aggregation Stages新的聚合阶段

MongoDB 5.1 introduces the following aggregation stages:MongoDB 5.1引入了以下聚合阶段:

Stage阶段Description描述
$densifyCreates new documents in a sequence of documents where values in a specified field are missing.在指定字段中缺少值的文档序列中创建新文档。
$documentsReturns literal documents from input expressions.从输入表达式返回文本文档。

New Aggregation Operators新的聚合运算符

MongoDB 5.1 introduces the following aggregation operators:MongoDB 5.1引入了以下聚合运算符:

Operator运算符Description描述
$tsSecond

Returns the seconds from a timestamp as a long.时间戳中的秒数返回为long

$tsIncrement

Returns the incrementing ordinal from a timestamp as a long.时间戳中的递增序号作为long返回。

$geoNear accepts let-bound variables$geoNear接受let-bound变量

Starting in MongoDB 5.1, the near parameter in the $geoNear aggregation stage supports the let option and bound let option.从MongoDB 5.1开始,$geoNear聚合阶段中的near参数支持let选项绑定let选项

$lookup and $graphLookup with sharded collections$lookup$graphLookup与分片集合

Starting in MongoDB 5.1, the $lookup and $graphLookup aggregation stages support sharded collections in the from parameter.从MongoDB 5.1开始,$lookup$graphLookup聚合阶段支持from参数中的分片集合

In previous versions of MongoDB, $lookup and $graphLookup only allowed for unsharded from collections.在以前版本的MongoDB中,$lookup$graphLookup只允许从集合中取消分片。

General Aggregation Improvements总体聚合改进

Starting in MongoDB 5.1, $dateSubtract and $dateAdd report an error when an overflow is detected for amount values.从MongoDB 5.1开始,$dateSubtract$dateAdd在检测到amount溢出时报告错误。

Time Series Collections时间序列集合

Geo Indexing for Time Series collections时间序列集合的地理索引

Starting in MongoDB 5.1, you can use geo indexes on the metaField of time series collections.从MongoDB 5.1开始,可以在时间序列集合的metaField上使用地理索引

Updates and Deletes更新和删除

Starting in MongoDB 5.1, time series collections support update and delete operations with limitations.从MongoDB 5.1开始,时间序列集合支持有限制的更新和删除操作

Sharded Time Series Collections分片时间序列集合

MongoDB 5.1 provides support for sharded time series collections.MongoDB 5.1支持分片时间序列集合

See:

Slot-Based Query Execution Engine基于时隙的查询执行引擎

Starting in MongoDB 5.1, a new query execution engine is used for eligible queries. 从MongoDB 5.1开始,新的查询执行引擎用于符合条件的查询。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设置基于插槽的查询执行计划缓存大小

You can set the size of the plan cache for the new query engine with the planCacheSize parameter.可以使用planCacheSize参数为新查询引擎设置计划缓存的大小。

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换流

Starting in MongoDB 5.1, change streams are optimized, providing more efficient resource utilization and faster execution of some aggregation pipeline stages.从MongoDB 5.1开始,更改流得到了优化,提供了更高效的资源利用率和更快的某些聚合管道阶段的执行。

Indexes索引

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.从MongoDB 5.1开始,可以使用collMod数据库命令将expireAfterSeconds选项添加到现有的单字段非TTL索引中。

Platform Support平台支撑

Starting in MongoDB 5.1.2 the following platforms are no longer supported.从MongoDB 5.1.2开始,以下平台不再受支持。

Community Edition社区版

  • RHEL-72-s390x

General Improvements总体改进

Metadata Option Added for validate Commandvalidate命令添加了元数据选项

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.从MongoDB 5.1(和MongoDB 5.0.4)开始,validate命令和db.collection.validate()助手方法有一个新的元数据选项,可以快速验证集合并检测无效的索引选项。

serverStatus Output Change输出变化

serverStatus includes the following new fields in its output:在其输出中包括以下新字段:

Aggregation Metrics聚合度量
Opcode Counters操作码计数器
  • opcounters.deprecated A count of how often deprecated opcodes run.不推荐的操作码运行频率的计数。
Resharding Statistics重装统计

Extra Logging Fields for Slow Queries with getMore Command使用getMore命令进行慢速查询时的额外日志字段

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.从MongoDB 5.1开始,当getMore命令作为慢速查询记录时,queryHashplanCacheKey字段将添加到慢速查询日志消息和探查器日志消息中。

Schema Validation Errors Contain Description Field架构验证错误包含描述字段

Starting in MongoDB 5.1, when a document fails schema validation, MongoDB includes the validation title and description in the error response. 从MongoDB 5.1开始,当文档未能通过模式验证时,MongoDB会在错误响应中包含验证标题和说明。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复制集

Assert Cluster Wide Write Concern is Set When Starting or Adding Shard启动或添加分片时设置了断言群集范围的写入问题

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.从MongoDB 5.1开始,在使用sh.addShard()启动、重新启动或添加分片服务器时,必须设置集群范围的写入关注点(CWWC)

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.如果未设置CWWC,并且已将分片配置为默认写入关注点{w:1},则分片服务器将无法启动或添加,并返回错误。

See default write concern calculations for details on how the default write concern is calculated.有关如何计算默认写入关注点的详细信息,请参阅默认写入关注点计算。

rs.reconfig Cluster Wide Write Concern Validation集群范围的写关注点验证

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.从MongoDB 5.1开始,必须先设置集群范围的写关注点(CWWC),然后再进行任何reconfigs,否则会更改新副本集成员的默认写关注点

storeFindAndModifyImagesInSideCollection Parameter参数

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).从MongoDB 5.1开始,storeFindAndModifyImagesInSideCollection参数确定可检索retryable findAndModify命令所需的临时文档是否存储在side集合(config.image_collection)中。

Sharded Clusters分片群集

mongod Sharded Cluster And Config Server Changes分片群集和配置服务器更改

Starting in MongoDB 5.1, when starting a mongod with the --configsvr option you must also specify a --replSet.从MongoDB 5.1开始,当使用--configsvr选项启动mongod时,还必须指定--replSet

Starting in MongoDB 5.1, when starting a mongod with the --shardsvr option you must also specify a --replSet.从MongoDB 5.1开始,当使用--shardsvr选项启动mongod时,还必须指定--replSet

Security安全

SELinux

Starting in MongoDB 5.1, there is a new SE Linux Policy for:从MongoDB 5.1开始,有一个新的SE Linux策略:

  • MongoDB Enterprise Server
  • MongoDB Community Edition Server

running on Red Hat Linux. 在Red Hat Linux上运行。The SELinux policy is for use with default installations using rpm installer packages.SELinux策略用于使用rpm安装程序包的默认安装。

Report an Issue报告一个问题

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.要报告问题,请参阅https://github.com/mongodb/mongo/wiki/Submit-Bug-Reports了解有关如何为MongoDB服务器或其中一个相关项目提交JIRA票证的说明。

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