On this page本页内容
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版本控制。
MongoDB 5.1 Released November 9, 2021MunGDB 5.1发布于2021年11月9日
Issues fixed:
false
Issues fixed:
MongoDB 5.1 introduces the following aggregation stages:MongoDB 5.1引入了以下聚合阶段:
$densify | |
$documents |
MongoDB 5.1 introduces the following aggregation operators:MongoDB 5.1引入了以下聚合运算符:
$tsSecond |
|
$tsIncrement |
|
let-bound
variables$geoNear
接受let-bound
变量Starting in MongoDB 5.1, the 从MongoDB 5.1开始,near
parameter in the $geoNear
aggregation stage supports the let option and bound let option.$geoNear
聚合阶段中的near
参数支持let选项和绑定let选项。
$lookup
和$graphLookup
与分片集合Starting in MongoDB 5.1, the 从MongoDB 5.1开始,$lookup
and $graphLookup
aggregation stages support sharded collections in the from
parameter.$lookup
和$graphLookup
聚合阶段支持from
参数中的分片集合。
In previous versions of MongoDB, 在以前版本的MongoDB中,$lookup
and $graphLookup
only allowed for unsharded from
collections.$lookup
和$graphLookup
只允许从集合中取消分片。
Starting in MongoDB 5.1, 从MongoDB 5.1开始,$dateSubtract
and $dateAdd
report an error when an overflow is detected for amount
values.$dateSubtract
和$dateAdd
在检测到amount
溢出时报告错误。
Starting in MongoDB 5.1, you can use geo indexes on the 从MongoDB 5.1开始,可以在时间序列集合的metaField
of time series collections.metaField
上使用地理索引。
Starting in MongoDB 5.1, time series collections support update and delete operations with limitations.从MongoDB 5.1开始,时间序列集合支持有限制的更新和删除操作。
MongoDB 5.1 provides support for sharded time series collections.MongoDB 5.1支持分片时间序列集合。
See:
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.如果使用基于插槽的查询执行引擎,查询解释计划输出中将包含新字段。
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.这可以提高查询性能,但会增加内存使用。
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开始,更改流得到了优化,提供了更高效的资源利用率和更快的某些聚合管道阶段的执行。
Starting in MongoDB 5.1, you can use the 从MongoDB 5.1开始,可以使用collMod
database command to add the expireAfterSeconds
option to an existing single-field non-TTL index.collMod
数据库命令将expireAfterSeconds
选项添加到现有的单字段非TTL索引中。
Starting in MongoDB 5.1.2 the following platforms are no longer supported.从MongoDB 5.1.2开始,以下平台不再受支持。
validate
Commandvalidate
命令添加了元数据选项Starting in MongoDB 5.1 (and MongoDB 5.0.4), the 从MongoDB 5.1(和MongoDB 5.0.4)开始,validate
command and the db.collection.validate()
helper method have a new metadata option that quickly validates collections and detects invalid index options.validate
命令和db.collection.validate()
助手方法有一个新的元数据选项,可以快速验证集合并检测无效的索引选项。
serverStatus
serverStatus
includes the following new fields in its output:在其输出中包括以下新字段:
metrics.operatorCounters.match
opcounters.deprecated
getMore
CommandgetMore
命令进行慢速查询时的额外日志字段Starting in MongoDB 5.1, when a 从MongoDB 5.1开始,当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.getMore
命令作为慢速查询记录时,queryHash和planCacheKey字段将添加到慢速查询日志消息和探查器日志消息中。
Starting in MongoDB 5.1, when a document fails schema validation, MongoDB includes the validation 从MongoDB 5.1开始,当文档未能通过模式验证时,MongoDB会在错误响应中包含验证标题和说明。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 从MongoDB 5.1开始,在使用sh.addShard()
the Cluster Wide Write Concern (CWWC) must be set.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
Starting in MongoDB 5.1, you must set the Cluster Wide Write Concern (CWWC) prior to issuing any 从MongoDB 5.1开始,必须先设置集群范围的写关注点(CWWC),然后再进行任何reconfigs
that would otherwise change the default write concern of the new replica set member.reconfigs
,否则会更改新副本集成员的默认写关注点。
storeFindAndModifyImagesInSideCollection
Starting in MongoDB 5.1, the 从MongoDB 5.1开始,storeFindAndModifyImagesInSideCollection
parameter determines whether the temporary documents required for retryable findAndModify
commands are stored in the side collection (config.image_collection
).storeFindAndModifyImagesInSideCollection
参数确定可检索retryable findAndModify
命令所需的临时文档是否存储在side集合(config.image_collection
)中。
mongod
Starting in MongoDB 5.1, when starting a 从MongoDB 5.1开始,当使用mongod
with the --configsvr
option you must also specify a --replSet
.--configsvr
选项启动mongod
时,还必须指定--replSet
。
Starting in MongoDB 5.1, when starting a 从MongoDB 5.1开始,当使用mongod
with the --shardsvr
option you must also specify a --replSet
.--shardsvr
选项启动mongod
时,还必须指定--replSet
。
Starting in MongoDB 5.1, there is a new SE Linux Policy for:从MongoDB 5.1开始,有一个新的SE Linux策略:
running on Red Hat Linux. 在Red Hat Linux上运行。The SELinux policy is for use with default installations using SELinux策略用于使用rpm
installer packages.rpm
安装程序包的默认安装。
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票证的说明。