Release Notes for MongoDB 5.2MongoDB 5.2的发行说明

On this page本页内容

Important重要的

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

Note注意

MongoDB 5.2 Released January 19, 2022MongoDB 5.2于2022年1月19日发布

Patch Releases补丁发布

5.2.1 - February 24, 2022

Issues fixed:

  • SERVER-63145 Query $densify produces incorrect results with optimizations enabled查询$densitify在启用优化的情况下生成不正确的结果
  • SERVER-62981 Make SBE multi-planner's trial period termination condition independent of collection size使SBE multi planner的试用期终止条件独立于收集规模
  • SERVER-62277 Performance regression from dbstats due to occupied disk space calculation由于占用磁盘空间计算,dbstats的性能下降
  • SERVER-62065 Upgrade path from 3.6 to 4.0 can leave chunk entries without history on the shards从3.6到4.0的升级路径可以在碎片上留下没有历史记录的区块条目
  • SERVER-59754 Incorrect logging of queryHash/planCacheKey for operations that share the same $lookup shape对于共享相同$lookup形状的操作,queryHash/planCacheKey的记录不正确
  • All JIRA issues closed in 5.2.1
  • 5.2.1 Changelog

Aggregation聚集

New Aggregation Operators新的聚合运算符

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

Operator运算符Description描述
$bottomReturns the bottom element within a group according to the specified sort order.根据指定的排序顺序返回组中的底部元素。
$bottomNReturns an aggregation of the bottom n elements within a group, according to the specified sort order.根据指定的排序顺序,返回组中底部n个元素的聚合。
$firstNReturns an aggregation of the first n elements within a group. Distinct from the $firstN array operator.返回组中前n个元素的聚合。与$firstN数组运算符不同。
$firstN (array operator)Returns a specified number of elements from the beginning of an array. 从数组的开头返回指定数量的元素。Distinct from the $firstN accumulator.$firstN累加器不同。
$lastNReturns an aggregation of the last n elements within a group. 返回组中最后n个元素的聚合。Distinct from the $lastN array operator.$lastN数组运算符不同。
$lastN (array operator)Returns a specified number of elements from the end of an array. 从数组末尾返回指定数量的元素。Distinct from the $lastN accumulator.$lastN累加器不同。
$locf

Last observation carried forward. 最后的观察结果继续进行。Sets values for null and missing fields in a window to the last non-null value for the field.窗口null字段和缺失字段的值设置为该字段的最后一个非空值。

$maxNReturns an aggregation of the n maximum valued elements within a group. 返回组中n个最大值元素的聚合。Distinct from the $maxN array operator.$maxN数组运算符不同。
$maxN (array operator)Returns the n largest values in an array. 返回数组中的n个最大值。Distinct from the $maxN accumulator.$maxN累加器不同。
$minNReturns an aggregation of the n minimum valued elements within a group. 返回组中n个最小值元素的聚合。Distinct from the $minN array operator.$minN数组运算符不同。
$minN (array operator)Returns the n smallest values in an array. 返回数组中的n个最小值。Distinct from the $minN accumulator.不同于$minN累加器。
$topReturns the top element within a group according to the specified sort order. 根据指定的排序顺序返回组中的顶部元素。Distinct from the command top.与命令top不同。
$topNReturns an aggregation of the top n elements within a group, according to the specified sort order.根据指定的排序顺序,返回组中前n个元素的聚合。
$sortArraySorts an array based on its elements.根据数组的元素对数组进行排序。

General Aggregation Improvements总体聚合改进

$filter Operator's limit Field运算符的limit字段

Starting in MongoDB 5.2, the $filter operator includes the optional limit field. 从MongoDB 5.2开始,$filter运算符包括可选的limit字段。The limit field restricts the number of matching array elements that the $filter operator returns.limit字段限制$filter运算符返回的匹配数组元素的数量。

$convert Supports Timestamp Conversion to Date支持将时间戳转换为日期

Starting in MongoDB 5.2, you can convert timestamps to dates using the $convert operator. 从MongoDB 5.2开始,可以使用$convert运算符将时间戳转换为日期。The $toDate operator can also convert timestamps.$toDate运算符也可以转换时间戳。

Improved Precision for Operator Counters提高运算符计数器的精度

Starting in MongoDB 5.2 and 5.0.6, aggregation operator metrics are more precise: internal processing does not inflate the counters.从MongoDB 5.2和5.0.6开始,聚合运算符度量更精确:内部处理不会使计数器膨胀。

Slot-Based Query Execution Engine Can Execute $group Stages基于插槽的查询执行引擎可以执行$group阶段

Starting in MongoDB 5.2, MongoDB uses the slot-based execution query engine to execute $group stages when $group is either:从MongoDB 5.2开始,MongoDB使用基于插槽的执行查询引擎来执行$group阶段,其中$group为:

  • The first stage in the pipeline.第一阶段正在进行中。
  • Part of a series of stages executed by the slot-based engine that occurs at the beginning of the pipeline. 由基于插槽的引擎执行的一系列阶段的一部分,这些阶段发生在管道的开头。For example, if a pipeline begins with $match followed by $group, the $match and $group stages are executed by the slot-based engine.例如,如果管道以$match开头,后跟$group,那么$match$group阶段将由基于插槽的引擎执行。

In most cases, the slot-based engine provides improved performance and lower CPU and memory costs compared to the classic query engine.在大多数情况下,与经典的查询引擎相比,基于插槽的引擎提供了更好的性能和更低的CPU和内存成本。

See $group Optimization.请参阅$group优化。

Time Series Collections时间序列集合

Data Compression数据压缩

Starting in MongoDB 5.2, time series collection data is further compressed to save database space. 从MongoDB 5.2开始,时间序列采集数据被进一步压缩以节省数据库空间。This compression does not affect query results, nor does it negatively affect performance.这种压缩不会影响查询结果,也不会对性能产生负面影响。

See time series collection behavior.请参见时间序列集合行为

Sharding Administration Commands分片管理命令

Starting in MongoDB 5.2, you can run sharding administration commands (such as moveChunk) on the system.buckets collection.从MongoDB 5.2开始,可以在system.buckets集合上运行分片管理命令(例如moveChunk)。

Sharding分片

Starting in MongoDB 5.2, the time that a mongos was started is included in the:从MongoDB 5.2开始,mongos的启动时间包括在以下内容中:

Default Chunk Size Increased from 64 MB to 128 MB默认块大小从64MB增加到128MB

Starting in MongoDB 5.2, the default chunk size is 128 megabytes. 从MongoDB 5.2开始,默认块大小为128 MB。In earlier versions of MongoDB, the default chunk size is 64 megabytes.在早期版本的MongoDB中,默认块大小为64 MB。

Prevent Migrations on a Sharded Collection with setAllowMigrations使用setAllowMigrations防止碎片集合上的迁移

Starting in MongoDB 5.2, the setAllowMigrations command:从MongoDB 5.2开始,setAllowMigrations命令:

Limit Wait Time For Critical Section限制关键部分的等待时间

Starting in MongoDB 5.2 (and 5.0.4, 5.1.0)从MongoDB 5.2(和5.0.4、5.1.0)开始

The metadataRefreshInTransactionMaxWaitBehindCritSecMS parameter limits the time a shard waits for a critical section within a transaction.metadataRefreshInTransactionMaxWaitBehindCritSecMS参数限制碎片在事务中等待关键部分的时间。

General Improvements总体改进

Configure Refresh Interval for Cached LDAP User Information为缓存的LDAP用户信息配置刷新间隔

Starting in MongoDB 5.2, you can use the following new server parameters to configure the refresh interval for cached LDAP user information:从MongoDB 5.2开始,您可以使用以下新服务器参数来配置缓存的LDAP用户信息的刷新间隔:

Starting in MongoDB 5.2, the update interval for cached user information retrieved from an LDAP server depends on ldapShouldRefreshUserCacheEntries:从MongoDB 5.2开始,从LDAP服务器检索的缓存用户信息的更新间隔取决于ldapShouldRefreshUserCacheEntries

Omit Custom Data from User Output从用户输出中省略自定义数据

Starting in MongoDB 5.2, you can omit customData from the response of the:从MongoDB 5.2开始,您可以从响应中省略customData

To omit custom data from command output, specify the showCustomData: false option.要从命令输出中省略自定义数据,请指定showCustomData: false选项。

Replica Sets复制集

initialSyncMethod Parameter参数

Starting in MongoDB 5.2, the initialSyncMethod determines whether initial sync is a logical initial sync or a file copy based initial sync.从MongoDB 5.2开始,initialSyncMethod确定初始同步逻辑初始同步还是基于文件副本的初始同步

initialSyncMethod is only available in MongoDB Enterprise Server.仅在MongoDB Enterprise Server中可用。

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.3Compatibility Changes in MongoDB 5.2 →