On this page本页内容
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版本控制。
MongoDB 5.2 Released January 19, 2022MongoDB 5.2于2022年1月19日发布
Issues fixed:
MongoDB 5.2 introduces the following aggregation operators:MongoDB 5.2引入了以下聚合运算符:
$bottom | |
$bottomN | n elements within a group, according to the specified sort order.n 个元素的聚合。 |
$firstN | n elements within a group. Distinct from the $firstN array operator.n 个元素的聚合。与$firstN 数组运算符不同。 |
$firstN (array operator) | $firstN accumulator.$firstN 累加器不同。 |
$lastN | n elements within a group. n 个元素的聚合。$lastN array operator.$lastN 数组运算符不同。 |
$lastN (array operator) | $lastN accumulator.$lastN 累加器不同。 |
$locf |
|
$maxN | n maximum valued elements within a group. n 个最大值元素的聚合。$maxN array operator.$maxN 数组运算符不同。 |
$maxN (array operator) | n largest values in an array. n 个最大值。$maxN accumulator.$maxN 累加器不同。 |
$minN | n minimum valued elements within a group. n 个最小值元素的聚合。$minN array operator.$minN 数组运算符不同。 |
$minN (array operator) | n smallest values in an array. n 个最小值。$minN accumulator.$minN 累加器。 |
$top | top .top 不同。 |
$topN | n elements within a group, according to the specified sort order.n 个元素的聚合。 |
$sortArray |
$filter
limit
Fieldlimit
字段Starting in MongoDB 5.2, the 从MongoDB 5.2开始,$filter
operator includes the optional limit
field. $filter
运算符包括可选的limit
字段。The limit
field restricts the number of matching array elements that the $filter
operator returns.limit
字段限制$filter
运算符返回的匹配数组元素的数量。
$convert
Starting in MongoDB 5.2, you can convert timestamps to dates using the 从MongoDB 5.2开始,可以使用$convert
operator. $convert
运算符将时间戳转换为日期。The $toDate
operator can also convert timestamps.$toDate
运算符也可以转换时间戳。
Starting in MongoDB 5.2 and 5.0.6, 从MongoDB 5.2和5.0.6开始,聚合运算符度量更精确:内部处理不会使计数器膨胀。aggregation operator metrics
are more precise: internal processing does not inflate the counters.
$group
Stages$group
阶段Starting in MongoDB 5.2, MongoDB uses the slot-based execution query engine to execute 从MongoDB 5.2开始,MongoDB使用基于插槽的执行查询引擎来执行$group
stages when $group
is either:$group
阶段,其中$group
为:
$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
优化。
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.这种压缩不会影响查询结果,也不会对性能产生负面影响。
Starting in MongoDB 5.2, you can run sharding administration commands (such as 从MongoDB 5.2开始,可以在moveChunk
) on the system.buckets
collection.system.buckets
集合上运行分片管理命令(例如moveChunk
)。
Starting in MongoDB 5.2, the time that a 从MongoDB 5.2开始,mongos
was started is included in the:mongos
的启动时间包括在以下内容中:
sh.status()
method (when verbose
is set to true
)sh.status()
方法的输出(当verbose
设置为true
时)config.mongos
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。
setAllowMigrations
setAllowMigrations
防止碎片集合上的迁移Starting in MongoDB 5.2, the 从MongoDB 5.2开始,setAllowMigrations
command:setAllowMigrations
命令:
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
参数限制碎片在事务中等待关键部分的时间。
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 从MongoDB 5.2开始,从LDAP服务器检索的缓存用户信息的更新间隔取决于ldapShouldRefreshUserCacheEntries
:ldapShouldRefreshUserCacheEntries
:
ldapUserCacheRefreshInterval
.true
,请使用ldapUserCacheRefreshInterval
。ldapUserCacheInvalidationInterval
.false
,请使用ldapUserCacheInvalidationInterval
。Starting in MongoDB 5.2, you can omit 从MongoDB 5.2开始,您可以从响应中省略customData
from the response of the:customData
:
usersInfo
db.getUser()
db.getUsers()
To omit custom data from command output, specify the 要从命令输出中省略自定义数据,请指定showCustomData: false
option.showCustomData: false
选项。
initialSyncMethod
Starting in MongoDB 5.2, the 从MongoDB 5.2开始,initialSyncMethod
determines whether initial sync is a logical initial sync or a file copy based initial sync.initialSyncMethod
确定初始同步是逻辑初始同步还是基于文件副本的初始同步。
initialSyncMethod
is only available in MongoDB Enterprise Server.仅在MongoDB Enterprise Server中可用。
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票证的说明。