Database Manual / Release Notes

Release Notes for MongoDB 8.2MongoDB 8.2发行说明

This page describes changes and new features introduced in MongoDB 8.2.本页介绍MongoDB 8.2中引入的更改和新功能。

MongoDB 8.2 is a minor Release, which means that it is supported for both MongoDB Atlas and on-premises deployments. MongoDB 8.2 introduces incremental improvements within a Major version release cycle. MongoDB 8.2 also includes changes introduced in MongoDB 8.1. This page describes changes introduced in the minor release and MongoDB 8.2.MongoDB 8.2是一个次要版本,这意味着它既支持MongoDB Atlas,也支持本地部署。MongoDB 8.2在主版本发布周期内引入了增量改进。MongoDB 8.2还包括MongoDB 8.1中引入的更改。本页描述了次要版本和MongoDB 8.2中引入的更改。

To learn more about the differences between Major and minor releases, see MongoDB Versioning.要了解更多关于主要版本和次要版本之间的差异,请参阅MongoDB版本控制

Important

MongoDB 8.3 is the latest minor release. Starting with MongoDB 8.2, minor releases are available for on-premises deployments (Community and EA) for specific use cases. For more information, see MongoDB Versioning.MongoDB 8.3是最新的次要版本。从MongoDB 8.2开始,次要版本可用于特定用例的本地部署(社区和EA)。有关更多信息,请参阅MongoDB版本控制

To install the latest MongoDB version supported for on-premises use, see the installation instructions.要安装支持本地使用的最新MongoDB版本,请参阅安装说明。

Important

mongosync is not supported in MongoDB 8.3.MongoDB 8.3不支持。

Patch Releases补丁发布

8.2.1 - Oct 3, 2025

Issues fixed:问题已解决:

  • SERVER-94681: Move sampling to the oplog cap maintainer thread:将取样移至oplog盖保持器螺纹
  • SERVER-106469: Starting mongocryptd fails on latest build, windows.:在最新版本windows上启动mongocryptd失败。
  • SERVER-109626: Adjust behavior for emitting additional fields in change streams:调整在更改流中发出其他字段的行为
  • SERVER-110250: Use existing session when dropping spill WT ident:在丢弃泄漏WT标识时使用现有会话
  • WT-15225: Fix newly created table and drop() EBUSY issue:修复新创建的表和drop()EBUSY问题
  • All JIRA issues closed in 8.2.1
  • 8.2.1 Changelog

Sharding分片

terminateSecondaryReadsOnOrphanCleanup Parameter参数

MongoDB 8.2 adds the terminateSecondaryReadsOnOrphanCleanup parameter, which controls whether long-running read operations on secondary nodes automatically terminate before orphaned document deletion following a chunk migration.MongoDB 8.2添加了terminateSecondaryReadsOnOrphanCleanup参数,该参数控制在块迁移后删除孤立文档之前,辅助节点上的长时间运行的读取操作是否自动终止。

By default, this parameter is set to true. If a read operation on a secondary node begins before the chunk migration commits, MongoDB automatically terminates the operation before deleting the orphaned documents. 默认情况下,此参数设置为true。如果在块迁移提交之前在辅助节点上开始读取操作,MongoDB会在删除孤立文档之前自动终止该操作。In MongoDB versions before 8.2, these operations continue executing after orphaned document deletion and may silently miss documents without returning an error.在8.2之前的MongoDB版本中,这些操作在删除孤立文档后继续执行,可能会默默地错过文档而不返回错误。

To support this new behavior, the default value for orphanCleanupDelaySecs is now 3600 (previously 900).为了支持这一新行为,orphanCleanupDelaySecs的默认值现在是3600(以前是900)。

General Changes一般变更

Index Builds During Initial Sync初始同步期间的索引构建

Starting in MongoDB 8.2, index builds during initial sync use 10% of available RAM by default. You can specify a different percentage of memory for MongoDB to use with the initialSyncIndexBuildMemoryPercentage parameter.从MongoDB 8.2开始,初始同步期间的索引构建默认使用10%的可用RAM。您可以使用initialSyncIndexBuildMemoryPercentage参数为MongoDB指定不同的内存百分比。

By default, the amount of available memory must be between 200 MB and 16 GB, inclusive. You use the following parameters to specify different minimum and maximum thresholds for memory usage:默认情况下,可用内存量必须在200 MB到16 GB之间(包括200 MB和16 GB)。您可以使用以下参数指定不同的内存使用最小和最大阈值:

Query Statistics查询统计信息

Starting in MongoDB 8.2, the $queryStats output includes the following metrics on delinquent tickets:从MongoDB 8.2开始,$queryStats输出包括以下关于拖欠票据的指标:

  • metrics.delinquentAcquisitions
  • metrics.totalAcquisitionDelinquencyMillis
  • metrics.maxAcquisitionDelinquencyMillis

MongoDB considers an execution ticket as delinquent when acquisition takes too long.当获取时间过长时,MongoDB将执行票视为拖欠。

WiredTiger Cache Size Configuration as a PercentageWiredTiger缓存大小配置百分比

Starting in MongoDB 8.2, you can configure the WiredTiger internal cache size using a new percentage-based option. 从MongoDB 8.2开始,您可以使用新的基于百分比的选项配置WiredTiger内部缓存大小。In addition to the existing --wiredTigerCacheSizeGB and storage.wiredTiger.engineConfig.cacheSizeGB gigabyte-based settings, you can now specify the cache size as a percentage of the available memory with the --wiredTigerCacheSizePct and storage.wiredTiger.engineConfig.cacheSizePct options.除了现有的基于--wiredTigerCacheSizeGBstorage.wiredTiger.engineConfig.cacheSizeGB千兆字节的设置外,您现在还可以使用--wiredTigerCacheSizePctstorage.wiredTiger.engineConfig.cacheSizePct选项将缓存大小指定为可用内存的百分比。

New Inconsistency Type: Range Deletion Missing Shard Key Index新的不一致类型:范围删除缺少分片键索引

Starting in MonogDB 8.2, a new inconsistency type RangeDeletionMissingShardKeyIndex is implemented. 从MonoDB 8.2开始,实现了一种新的不一致类型RangeDeletionMissingShardKeyIndexThe inconsistency type indicates that a sharded collection exists that doesn't have an index compatible with the collection shard key and there is at least one remaining range deletion task to complete.不一致类型表示存在一个分片集合,该集合没有与集合分片键兼容的索引,并且至少还有一个剩余的范围删除任务需要完成。

New Aggregation Expression新聚合表达式

Starting in MongoDB 8.2, you can use $currentDate with aggregate() to return the current time on the server.从MongoDB 8.2开始,您可以使用$currentDateaggregate()来返回服务器上的当前时间。

New $currentOp Field新的$currentOp字段

The $currentOp aggregation stage now includes the versionContext field, which provides information on the Feature Compatibility Version (FCV) of the operation.$currentOp聚合阶段现在包括versionContext字段,该字段提供有关操作的功能兼容性版本(FCV)的信息。

serverStatus Output Change输出更改

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

Explain Output for Disk Spilling Stages解释磁盘溢出阶段的输出

Starting in MongoDB 8.2, the Explain Results for stages that spill to disk now include standardized metrics under consistent field names. This update provides a more unified way to track disk usage for memory-intensive operations.从MongoDB 8.2开始,溢出到磁盘的阶段的解释结果现在包括一致字段名下的标准化指标。此更新提供了一种更一致性的方法来跟踪内存密集型操作的磁盘使用情况。

The new fields include:新字段包括:

Repair Mode Field in Validation Output验证输出中的修复模式字段

Starting in MongoDB 8.2, the validate command and the db.collection.validate() helper method return a new repairMode field that indicates what types of data inconsistencies the validate command attempted to repair, if detected.从MongoDB 8.2开始,validate命令和db.collection.validate()辅助方法返回一个新的repairMode字段,该字段指示validate命令尝试修复哪些类型的数据不一致(如果检测到)。

Support for zstd Fast Compression支持zstd快速压缩

Starting in MongoDB 8.2, The storage.wiredTiger.engineConfig.zstdCompressionLevel setting supports negative values for fast zstd compression. Negative values provide faster compression and decompression speeds at the cost of the compression ratio. The new supported range is -7 to 22.从MongoDB 8.2开始,storage.wiredTiger.engineConfig.zstdCompressionLevel设置支持负值以实现快速zstd压缩。负值以压缩比为代价提供更快的压缩和解压缩速度。新支持的范围是-7到22。

Targeted Mirrored Reads有针对性的镜像读取

Starting in MongoDB 8.2, you can selectively mirror read operations to specific servers that need their caches warmed up by tagging the nodes for read mirroring. Unlike general mirrored reads, targeted read mirroring allows you to target hidden nodes and mirror from both primary and secondary nodes.从MongoDB 8.2开始,您可以通过标记节点进行读取镜像,将读取操作选择性地镜像到需要预热缓存的特定服务器。与常规镜像读取不同,目标读取镜像允许您定位隐藏节点并从主节点和次节点进行镜像。

You can configure targeted mirrored reads using the targetedMirroring field in the mirrorReads parameter.您可以使用mirrorReads参数中的targetedMirroring字段配置目标镜像读取。

Rate Limit Ingress Connection Establishment速率限制入口连接建立

Starting in MongoDB 8.2, you can enable rate limiting for ingress connections to preserve CPU resources during overload. When enabled, you can see when the rate of incoming connections exceeds the connection establishment rate they specified and configure parameters to specify how your MongoDB deployment handles excess connections.从MongoDB 8.2开始,您可以为入口连接启用速率限制,以在过载期间保护CPU资源。启用后,您可以看到传入连接的速率何时超过他们指定的连接建立速率,并配置参数以指定MongoDB部署如何处理多余的连接。

You can configure rate limiting using the following new fields:您可以使用以下新字段配置速率限制:

Security安全

Queryable Encryption Prefix, Suffix, and Substring Query Public Preview可查询加密前缀、后缀和子字符串查询公共预览

Warning

Prefix, Suffix, and Substring Queries are in Public Preview前缀、后缀和子字符串查询处于公开预览状态

Queryable Encryption prefix, suffix, and substring queries are available in public preview in MongoDB 8.2. Do not enable these query types in production. Public preview functionality will be incompatible with the GA feature, and you will have to drop any collections that enable these queries.MongoDB 8.2的公共预览版中提供了可查询的加密前缀、后缀和子字符串查询。不要在生产环境中启用这些查询类型。公共预览功能将与GA功能不兼容,您必须删除启用这些查询的任何集合。

MongoDB 8.2 lets you enable prefix, suffix, and substring queries on encrypted string fields in Queryable Encryption enabled collections. MongoDB 8.2允许您在启用了可查询加密的集合中的加密字符串字段上启用前缀、后缀和子字符串查询。For details, see enable substring queries and Supported Aggregation Expressions.有关详细信息,请参阅启用子字符串查询支持的聚合表达式

Known Issues已知问题

This section describes known issues in MongoDB 8.2 and their resolution status.本节介绍MongoDB 8.2中的已知问题及其解决状态。

In Version在版本中Issue问题Status状态
8.2.0SERVER-106469: The mongocryptd, mongod, and mongos processes do not start on Windows when launched with the --logpath NUL argument. SERVER-106469:当使用--logpath NUL参数启动时,mongocryptdmongodmongos进程不会在Windows上启动。A third-party dependency mistakenly disallows the use of NUL, resulting in this log file path preventing mongocryptd from starting. MongoDB drivers may fail to start mongocryptd successfully on Windows if --logpath NUL is specified. 第三方依赖错误地禁止使用NUL,导致此日志文件路径阻止mongocryptd启动。如果指定了--logpath NUL,MongoDB驱动程序可能无法在Windows上成功启动mongocryptdThe MongoDB .NET/C# Driver uses --logpath NUL in its default configuration and will fail to start on Windows.MongoDB NET/C#驱动程序在其默认配置中使用--logpath NUL,将无法在Windows上启动。
You can avoid the .NET/C# Driver mongocryptd issue in the following ways:您可以通过以下方式避免NET/C#驱动程序mongocryptd问题:
We are targeting a fix for this issue in MongoDB 8.2.1.目标是在MongoDB 8.2.1中修复此问题。
8.2.0SERVER-109626: v8.2.0 introduces some change stream performance regressions. Applications relying on change streams for real-time data processing may experience up to a 15% performance degradation compared to v8.0.SERVER-109626:v8.2.0引入了一些变更流性能回归。与v8.0相比,依赖更改流进行实时数据处理的应用程序可能会出现高达15%的性能下降。We are targeting a fix for this issue in MongoDB 8.2.1.目标是在MongoDB 8.2.1中修复此问题。
8.2.0SERVER-110250: Users running memory-intensive operations that require disk spilling can experience server crashes if the number of actively spilling queries exceeds 1000. To mitigate this issue, raise the spillWiredTigerSessionMax setParameter value to a higher value.:如果主动溢出查询的数量超过1000,则运行需要磁盘溢出的内存密集型操作的用户可能会遇到服务器崩溃。为了缓解此问题,请将spillWiredTigerSessionMaxsetParameter值提高到更高的值。We are targeting a fix for this issue in MongoDB 8.2.1.目标是在MongoDB 8.2.1中修复此问题。

Changes Introduced in MongoDB 8.1MongoDB 8.1中引入的更改

The following section describes changes and new features introduced in MongoDB 8.1.以下部分描述了MongoDB 8.1中引入的更改和新功能。

Add Comments to Query Settings向查询设置添加注释

Starting in MongoDB 8.1 (and 8.0.4), you can use setQuerySettings to add comments to query settings. For example, add a comment that indicates why you added query settings.从MongoDB 8.1(和8.0.4)开始,您可以使用setQuerySettings向查询设置添加注释。例如,添加一条注释,说明添加查询设置的原因。

Aggregation Accumulators聚合累加器

Starting in MongoDB 8.1, the following aggregation accumulators are available:从MongoDB 8.1开始,以下聚合累加器可用:

Aggregation Stages聚合阶段

Starting in MongoDB 8.1, the following aggregation stages are available:从MongoDB 8.1开始,可以使用以下聚合阶段:

Audit Log Improvements审计日志改进

Starting in MongoDB 8.1, if a client application connects to mongos through a load balancer, the origin client computer and load balancer IP addresses and ports are included in the audit log. You can use the log to match an audit event with the origin client computer.从MongoDB 8.1开始,如果客户端应用程序通过负载均衡器连接到mongos,则源客户端计算机和负载均衡器IP地址和端口将包含在审计日志中。您可以使用日志将审核事件与源客户端计算机进行匹配。

For details, see OCSF Schema Audit Messages and mongo Schema Audit Messages.有关详细信息,请参阅OCSF架构审计消息mongo架构审计消息

connectionStatus Connection UUID连接UUID

Starting in MongoDB 8.1, you can access the currently connected client's UUID through connectionStatus.authInfo.UUID.从MongoDB 8.1开始,您可以通过connectionStatus.authInfo.UUID访问当前连接的客户端的UUID。

Disk Space磁盘空间

Starting in MongoDB 8.1 (and 8.0.5), if disk space is running low, MongoDB will fail queries that are spilling to disk.从MongoDB 8.1(和8.0.5)开始,如果磁盘空间不足,MongoDB将失败溢出到磁盘的查询。

$geoNear Improvements改进

Starting in MongoDB 8.1, some previously failing $geoNear queries with hidden 2d or 2dsphere indexes will now succeed. 从MongoDB 8.1开始,一些以前失败的带有隐藏2d2dsphere索引的$geoNear查询现在将成功。In previous releases, some $geoNear queries used to unnecessarily fail with an IndexNotFound error when they included a hidden index due to confusion over which index to use.在以前的版本中,一些$geoNear查询在包含隐藏索引时由于对使用哪个索引的混淆而不必要地失败,并出现IndexNotFound错误。

Improved Accuracy for Operation Duration Metric提高了操作持续时间度量的准确性

Starting in MongoDB 8.1, the durationMillis metric reported in slow query logs accounts for time spent processing authorization and parsing the command. 从MongoDB 8.1开始,慢速查询日志中报告的durationMillis指标反映了处理授权和解析命令所花费的时间。As a result, durationMillis more closely reflects the full command duration.因此,durationMillis更准确地反映了完整的命令持续时间。

Inconsistency Types不一致类型

Starting in MongoDB 8.1, the following inconsistency types are available:从MongoDB 8.1开始,以下不一致类型可用:

$lookup Support for Encrypted Collections支持加密集合

Starting in MongoDB 8.1, you can reference multiple encrypted collections in a $lookup stage.从MongoDB 8.1开始,您可以在$lookup阶段引用多个加密集合。

To learn more, see:要了解更多信息,请参阅:

$merge Missing Fields$merge缺少的字段

Starting in MongoDB 8.1, if the $merge aggregation stage's supporting index is not sparse, the fields specified for the on option can be missing or contain a null value.从MongoDB 8.1开始,如果$merge聚合阶段的支持索引不是稀疏的,则为on选项指定的字段可能会丢失或包含空值。

Query Statistics查询统计信息

Starting in MongoDB 8.1, query statistics are collected and reported for count and distinct commands. 从MongoDB 8.1开始,集合并报告count(计数)和distinct(不同)命令的查询统计信息。For details, see count Command Query Shape and distinct Command Query Shape.有关详细信息,请参阅计数命令查询形状不同命令查询形状

Server Parameters服务器参数

Starting in MongoDB 8.1, the following server parameters are available:从MongoDB 8.1开始,以下服务器参数可用:

serverStatus Metrics指标

Starting in MongoDB 8.1 (and 8.0.4 and 7.0.14), the indexStats section of the serverStatus command output tracks indexes in prepareUnique state.从MongoDB 8.1(以及8.0.4和7.0.14)开始,serverStatus命令输出的indexStats部分跟踪prepareUnique状态下的索引。

MongoDB 8.1 adds the following server status metrics:MongoDB 8.1增加了以下服务器状态指标:

Slow Query Metrics for Disk Spilling磁盘溢出的慢速查询指标

Starting in MongoDB 8.1, log messages for slow queries contain new metrics if the query execution writes temporary files to disk. 从MongoDB 8.1开始,如果查询执行将临时文件写入磁盘,则慢速查询的日志消息将包含新的指标。These metrics are prefixed by the query execution stage that caused the query to exceed the memory limit. For example, sortSpills indicates the number of times that the sort stage of query execution wrote temporary files to disk.这些指标以导致查询超过内存限制的查询执行阶段作为前缀。例如,sortSpills表示查询执行的排序阶段将临时文件写入磁盘的次数。

Metric指标Description描述

<executionPart>Spills

Number of times the corresponding query execution stage wrote temporary files to disk相应查询执行阶段将临时文件写入磁盘的次数

<executionPart>SpilledBytes

Size, in bytes, of the memory released by writing temporary files to disk通过将临时文件写入磁盘而释放的内存大小(以字节为单位)

<executionPart>SpilledDataStorageSize

Size, in bytes, of disk space used for temporary files用于临时文件的磁盘空间大小(以字节为单位)

<executionPart>SpilledRecords

Number of records written to temporary files on disk写入磁盘临时文件的记录数

For more information on writing temporary files to disk, see allowDiskUse().有关将临时文件写入磁盘的更多信息,请参阅allowDiskUse()

Stable APIAPI稳定

Starting in MongoDB 8.1, the renameCollection command and corresponding shell method, db.collection.renameCollection(), are included in Stable API V1.从MongoDB 8.1开始,renameCollection命令和相应的shell方法db.collection.renameCollection()包含在Stable API V1中。

Support for Search Stages in Explain Results在解释结果中支持搜索阶段

Starting in MongoDB 8.1, the explain results include execution stats for the $search, $searchMeta, and $vectorSearch stages.从MongoDB 8.1开始,解释结果包括$search$searchMeta$vectorSearch阶段的执行统计数据。

To learn more, see:要了解更多信息,请参阅:

Support for Search Index Commands on Views支持视图上的搜索索引命令

Starting in MongoDB 8.1, you can run createSearchIndexes, updateSearchIndex, dropSearchIndex, and $listSearchIndexes to create, modify, drop, and list Atlas Search indexes and Atlas Vector Search indexes on compatible standard views that contain only the following stages:从MongoDB 8.1开始,您可以运行createSearchIndexesupdateSearchIndexdropSearchIndex$listSearchIndexes,在仅包含以下阶段的兼容标准视图上创建、修改、删除和列出Atlas搜索索引和Atlas矢量搜索索引:

You can run aggregation pipelines that contain $search and $searchMeta stages on views that use a search index. 您可以在使用搜索索引的视图上运行包含$search$searchMeta阶段的聚合管道。You can also run aggregation pipelines that contain a $vectorSearch stage on views that contain a vector search index.您还可以在包含向量搜索索引的视图上运行包含$vectorSearch阶段的聚合管道。

Validate Command Index Specifications Output验证命令索引规范输出

Starting in MongoDB 8.1, the validate command includes index specifications in the validate.indexDetails output field.从MongoDB 8.1开始,validate命令在validate.indexDetails输出字段中包含索引规范。

Validation Action for Handling Invalid Documents处理无效文件的验证操作

Starting in MongoDB 8.1, you can set your schema's validationAction option to errorAndLog, in which MongoDB rejects any insert or update that violates the validation criteria and logs the error to the mongod log file.从MongoDB 8.1开始,您可以将模式的validationAction选项设置为errorAndLog,在该选项中,MongoDB拒绝任何违反验证标准的插入或更新,并将错误记录到mongod日志文件中。

For more information, see Choose How to Handle Invalid Documents.有关更多信息,请参阅选择如何处理无效文档

Upgrade Procedures升级程序

Important

Feature Compatibility Version功能兼容性版本

To upgrade to MongoDB 8.2 from a 8.0 deployment, the 8.0 deployment must have featureCompatibilityVersion set to 8.0. To check the version:要从8.0部署升级到MongoDB 8.2,8.0部署必须将featureCompatibilityVersion设置为8.0。要检查版本,请执行以下操作:

db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )

To upgrade to MongoDB 8.2, refer to the upgrade instructions specific to your MongoDB deployment:要升级到MongoDB 8.2,请参阅特定于MongoDB部署的升级说明:

If you need guidance on upgrading to 8.2, MongoDB professional services offer support to help ensure a smooth transition without interruption to your MongoDB application. 如果您需要升级到8.2的指导,MongoDB专业服务提供支持,以帮助确保顺利过渡到MongoDB应用程序,而不会中断。To learn more, see MongoDB Consulting.要了解更多信息,请参阅MongoDB咨询

Download下载

To download MongoDB 8.2, go to the MongoDB Download Center.要下载MongoDB 8.2,请访问MongoDB下载中心

Downgrade Considerations降级注意事项

Only Single-Version Downgrades are Supported仅支持单版本降级

MongoDB only supports single-version downgrades. You cannot downgrade to a release that is multiple versions behind your current release.MongoDB只支持单版本降级。您不能降级到比当前版本落后多个版本的版本。

For example, you can downgrade a 8.2-series to a 8.0-series deployment. However, further downgrading that 8.0-series deployment to a 7.0-series deployment is not supported.例如,您可以将8.2系列部署降级为8.0系列部署。但是,不支持将8.0系列部署进一步降级为7.0系列部署。

Downgrade Policy降级政策

  • Binary downgrades aren't supported for MongoDB Community Edition.MongoDB社区版不支持二进制降级。
  • You cannot downgrade your deployment's FCV to or from a minor release version of MongoDB.您不能将部署的FCV降级到MongoDB的次要版本或从MongoDB的次要发布版本降级。
  • If you upgrade or downgrade your deployment's FCV, you cannot downgrade your Enterprise deployment's binary version without assistance from support.如果升级或降级部署的FCV,则在没有支持人员帮助的情况下,无法降级企业部署的二进制版本。