This page describes changes and new features introduced in MongoDB 8.0.本页介绍MongoDB 8.0中引入的更改和新功能。
MongoDB 8.0 is a Major Release, which means that it is supported for both MongoDB Atlas and on-premises deployments. MongoDB 8.0 includes changes introduced in MongoDB Rapid Releases 7.1, 7.2, and 7.3. This page describes changes introduced in those Rapid Releases and MongoDB 8.0.MongoDB 8.0是一个主要版本,这意味着它既支持MongoDB Atlas,也支持本地部署。MongoDB 8.0包括MongoDB Rapid Release 7.1、7.2和7.3中引入的更改。本页描述了这些快速版本和MongoDB 8.0中引入的更改。
MongoDB Atlas runs auto-upgrade for dedicated clusters (M10+) to Major version if 如果启用了最新版本(自动升级)选项,MongoDB Atlas会自动将专用集群(M10+)升级到主版本。Latest Release (auto-upgrades) option is enable. If you want to upgrade your MongoDB Atlas manually see Upgrade a Cluster to a New MongoDB Version, to learn more about MongoDB cluster versions in Atlas see Which versions of MongoDB do Atlas clusters use如果你想手动升级你的MongoDB Atlas,请参阅将集群升级到新的MongoDB版本,了解更多关于Atlas中MongoDB集群版本的信息,请参阅Atlas集群使用哪些版本的MongoDB
To learn more about the differences between Major and Rapid releases, see MongoDB Versioning.要了解更多关于主要版本和快速版本之间的差异,请参阅MongoDB版本控制。
Warning
Past Release Limitations过去的发布限制
The Critical Advisories below affect some prior MongoDB versions. If your deployment depends on features impacted by a Critical Advisory, upgrade to the latest available patch release.下面的关键建议会影响一些以前的MongoDB版本。如果您的部署依赖于受关键咨询影响的功能,请升级到最新的可用补丁版本。
| SERVER-95067 | 8.0.0 - 8.0.3 |
| SERVER-94559 | 8.0.0 - 8.0.3 |
Patch Releases补丁发布
8.0.15 - Oct 2, 2025
This release contains security or reliability improvements. These release notes will be updated when more information is available.此版本包含安全性或可靠性改进。这些发行说明将在获得更多信息后更新。
8.0.14 - Sep 25, 2025
Issues fixed:已解决的问题:
- SERVER-100448
: Command registration should not depend on the FCV at startup:命令注册不应依赖于启动时的FCV - SERVER-103742
: opWriteConcernCounters can illegally embed a NUL bytes into ServerStatus:opWriteConcernCounters可以将NUL字节非法嵌入ServerStatus - SERVER-103841
: Memory leak in TransactionCoordinator associated to long-lived cancellation source:与长期取消源关联的TransactionCoordinator内存泄漏 - SERVER-105478
: Separate eligible and ineligible oplog entries for the applier with secondaryDelaySecs:将符合条件和不符合条件的oplog条目与二级DelaySecs分开 WT-14140
: Unnecessary schema lock taken for active "file:" dhandles that are not swept:对未扫描的活动“file:”数据处理程序采取了不必要的架构锁- WT-14653
: Add logs/stats to reconciliation for tracking HS updates:将日志/统计数据添加到对账中,以跟踪HS更新 All JIRA issues closed in 8.0.14所有JIRA问题已于8.0.14结束- 8.0.14 Changelog
8.0.13 - Aug 21, 2025
Issues fixed:已解决的问题:
- SERVER-77172
::abortExpiredTransactionsthread can get stuck if it fails to checkout a sessionabortExpiredTransactions线程如果无法签出会话,则可能会卡住 - SERVER-82180
: Capped inserts on the primary can have a different natural ordering from secondaries:primary上的封顶插入物可以具有与secondery不同的自然顺序 - SERVER-91686
: Improve:改进mongodsignal handler to print out current thread's command objectmongod信号处理程序,以打印出当前线程的命令对象 - SERVER-94315
: Shard filtering bug with collation:带有排序规则的分片筛选错误 - SERVER-102670
: Incorrect ordered time-series insert error handling:顺序不正确的时间序列插入错误处理 - SERVER-107361
: Rollover determination in the bucket catalog can fail to check mixed schema for large measurements:桶目录中的滚动确定可能无法检查大型度量的混合模式 All JIRA issues closed in 8.0.13所有JIRA问题已于8.0.13结束- 8.0.13 Changelog
8.0.12 - July 23, 2025
Issues fixed:已解决的问题:
- SERVER-95523
: upsert does not handle DuplicateKey retry correctly:upsert无法正确处理DuplicateKey重试 - SERVER-95524
: Avoid retrying on duplicate key error for upserts in multidocument transactions:避免在多文档事务中因出现异常而重试重复键错误 - SERVER-97368
: Enable TTL deletes on time-series collections containing data prior to 1970:对包含1970年之前数据的时间序列集合启用TTL删除 - SERVER-99342
: Throughput probing decrease metrics are not being updated:吞吐量探测减少指标未更新 - WT-14391
: Check eviction server is running before opening HS:打开HS之前,请检查驱逐服务器是否正在运行 All JIRA issues closed in 8.0.12所有JIRA问题已于8.0.12结束- 8.0.12 Changelog
8.0.11 - Jun 30, 2025
Issues fixed:已解决的问题:
- SERVER-105375
: Use EOF plan for alwaysFalse expressions within elemMatch:对elemMatch中的alwaysFalse表达式使用EOF计划 - SERVER-106614
: List of replica set hosts in config.shards entries not updated for shards added prior to 8.0:配置文件条目中的副本集主机列表未针对8.0之前添加的分片进行更新 All JIRA issues closed in 8.0.11所有JIRA问题已于8.0.11结束- 8.0.11 Changelog
8.0.10 - Jun 04, 2025
Issues fixed:已解决的问题:
- SERVER-90495
: Support start or resume from deleted recordId on natural order scan:支持在自然顺序扫描中从已删除的recordId开始或恢复 - SERVER-92806
: Plan cache entry ignores index collation with $elemMatch:计划缓存条目忽略使用$elemMatch的索引排序规则 - SERVER-96197
: ExpressionContext's _resolvedNamespaces can't distinguish between collections with the same name in different dbs:ExpressionContext的_resolvedNamespaces无法区分不同数据库中同名集合 - SERVER-100785
: Fatal crash of mongodb config server after issuing malformed reshardCollection command:发出格式错误的reshardCollection命令后,mongodb配置服务器严重崩溃 - WT-13216
: Assess the use of cache eviction check in compact:评估compact中缓存清除检查的使用情况 - All JIRA issues closed in 8.0.10
- 8.0.10 Changelog
8.0.9 - May 1, 2025
Important
Fix for incorrect handling of incomplete data may prevent mongos from accepting new connections修复了不正确处理不完整数据可能会阻止mongos接受新连接的问题
Due to CVE-2025-6714, in MongoDB 8.0 prior to 8.0.9, MongoDB Server's 由于CVE-2025-6714,在8.0.9之前的MongoDB 8.0中,由于对不完整数据的错误处理,MongoDB服务器的mongos component can become unresponsive to new connections due to incorrect handling of incomplete data. This issue affects sharded MongoDB clusters that are configured with load balancer support for mongos using HAProxy on specified ports.mongos组件可能对新连接没有响应。此问题会影响在指定端口上使用HAProxy为mongos配置负载均衡器支持的分片MongoDB集群。
This issue affects the following MongoDB Server versions:此问题影响以下MongoDB服务器版本:
- 8.0.0 - 8.0.8
- 7.0.0 - 7.0.19
- 6.0.0 - 6.0.22
CVSS Score: 7.5
CWE: CWE-834 Excessive Iteration AND CWE-400 Uncontrolled Resource Consumption:CWE-834过度迭代和CWE-400资源消耗失控
Issues fixed:已解决的问题:
- SERVER-92236
: Chunk migrations should use short lived cancellation sources:块迁移应使用短期取消源 - SERVER-106753
: Incorrect handling of incomplete data may prevent:对不完整数据的错误处理可能会阻止mongosfrom accepting new connectionsmongos接受新的连接 All JIRA issues closed in 8.0.9所有JIRA问题已于8.0.9完成- 8.0.9 Changelog
8.0.8 - Apr 14, 2025
Issues fixed:已解决的问题:
- SERVER-103328
Incorrect BSONColumn handling of skip after non-zero RLE for double type双精度类型非零RLE后跳过的BSONColumn处理不正确 All Jira issues closed in 8.0.8所有Jira问题都在8.0.8中关闭- 8.0.8 Changelog
8.0.7 - Apr 14, 2025
Important
MongoDB Server may be susceptible to privilege escalation due to $mergeCursors stage由于$mergeKursor阶段,MongoDB服务器可能容易受到权限升级的影响
Due to CVE-2025-6713, in MongoDB 8.0 prior to 8.0.7, an unauthorized user may leverage a specially crafted aggregation pipeline to access data without proper authorization due to improper handling of the 由于CVE-2025-6713,在8.0.7之前的MongoDB 8.0中,未经授权的用户可能会利用特制的聚合管道在没有适当授权的情况下访问数据,这是由于MongoDB服务器中$mergeCursors stage in MongoDB Server. This may lead to access to data without further authorization.$mergeCursors阶段处理不当造成的。这可能会导致在未经进一步授权的情况下访问数据。
This issue affects the following MongoDB Server versions:此问题影响以下MongoDB服务器版本:
- 8.0.0 - 8.0.6
- 7.0.0 - 7.0.18
- 6.0.0 - 6.0.21
CVSS Score: 7.7
CWE: CWE-285: Improper Authorization:CWE-285:授权不当
Issues fixed:已解决的问题:
- SERVER-106752
MongoDB Server may be susceptible to privilege escalation due to由于$mergeCursorsstage$mergeCursors阶段,MongoDB服务器可能容易受到权限升级的影响
8.0.6 - Mar 19, 2025
Issues fixed:已解决的问题:
- SERVER-87442
Platform Support: Add support for Macos 14 sonoma (ARM64 and AMD64)平台支持:添加对Macos 14 sonoma(ARM64和AMD64)的支持 - SERVER-89757
checkSbeStatus should check for all nodescheckSbeStatus应检查所有节点 - SERVER-97911
Query with "_id in empty array" traverses the full collection when given the _id index as a hint当给定_id索引作为提示时,使用“空数组中的_id”的查询会遍历整个集合 - SERVER-100901
Relax user digest invariant to tassert in ShardingTaskExecutor在ShardingTaskExecutor中将用户摘要不变量放宽为tassert SERVER-101838 Revert SERVER-93101 + SERVER-91121
All Jira issues closed in 8.0.6所有Jira问题都在8.0.6中关闭- 8.0.6 Changelog
8.0.5 - Feb 20, 2025
Important
Pre-Authentication Denial of Service Vulnerability in MongoDB Server's OIDC AuthenticationMongoDB服务器OIDC认证中的预认证拒绝服务漏洞
Due to CVE-2025-6709, in MongoDB 8.0 prior to 8.0.5, MongoDB Server is susceptible to a denial of service vulnerability due to improper handling of specific date values in JSON input when using OIDC authentication. This can be reproduced using the mongo shell to send a malicious JSON payload leading to an invariant failure and server crash.由于CVE-2025-6709,在8.0.5之前的MongoDB 8.0中,MongoDB服务器在使用OIDC身份验证时,由于对JSON输入中的特定日期值处理不当,容易受到拒绝服务漏洞的影响。这可以通过使用mongoshell发送恶意JSON有效负载来重现,从而导致不变的故障和服务器崩溃。
This issue affects the following MongoDB Server versions:此问题影响以下MongoDB服务器版本:
- 8.0.0 - 8.0.4
- 7.0.0 - 7.0.16
The same issue affects MongoDB Server v6.0, but an attacker can only induce denial of service after authenticating. This issue affects the following MongoDB Server versions:同样的问题也会影响MongoDB Server v6.0,但攻击者只能在身份验证后诱导拒绝服务。此问题影响以下MongoDB服务器版本:
- 6.0.0 - 6.0.20
CVSS Score: 7.5
CWE: CWE-20: Improper Input Validation:CWE-20:输入验证不当
Important
Pre-authentication Denial of Service Stack Overflow Vulnerability in JSON Parsing via Excessive Recursion in MongoDBMongoDB中过度递归JSON解析中的预认证拒绝服务堆栈溢出漏洞
Due to CVE-2025-6710, in MongoDB 8.0 prior to 8.0.5, MongoDB Server may be susceptible to stack overflow due to JSON parsing mechanism, where specifically crafted JSON inputs may induce unwarranted levels of recursion, resulting in excessive stack space consumption. Such inputs can lead to a stack overflow that causes the server to crash which could occur pre-authorisation.由于CVE-2025-6710,在8.0.5之前的MongoDB 8.0中,由于JSON解析机制,MongoDB服务器可能容易受到堆栈溢出的影响,其中特制的JSON输入可能会导致不必要的递归级别,从而导致过度的堆栈空间消耗。此类输入可能会导致堆栈溢出,从而导致服务器崩溃,这可能会发生预授权。
This issue affects the following MongoDB Server versions:此问题影响以下MongoDB服务器版本:
- 8.0.0 - 8.0.4
- 7.0.0 - 7.0.16
The same issue affects MongoDB Server v6.0, but an attacker can only induce denial of service after authenticating. This issue affects the following MongoDB Server versions:同样的问题也会影响MongoDB Server v6.0,但攻击者只能在身份验证后诱导拒绝服务。此问题影响以下MongoDB服务器版本:
- 6.0.0 - 6.0.20
CVSS Score: 7.5
CWE: CWE-674: Uncontrolled Recursion不受控制的递归
Issues fixed:已解决的问题:
- SERVER-51366
Configure folders created by installer配置安装程序创建的文件夹 - SERVER-93497
Move user cache invalidation from OpObserver to onCommit handlers将用户缓存无效从OpObserver移动到onCommit处理程序 - SERVER-95672
Indexes on array fields that contain subarrays do not include some results包含子数组的数组字段上的索引不包括某些结果 - SERVER-97044
Fix an issue where change streams might incorrectly output a "drop" event during resharding or unsharding of a collection that is or was using zone sharding修复了一个问题,即在对正在或曾经使用区域分片的集合进行重新分区或取消分区时,更改流可能会错误地输出“drop”事件 - SERVER-97860
Express path can return incorrect results when scanning a unique, multi-field index扫描唯一的多字段索引时,快速路径可能会返回不正确的结果 - SERVER-99290
Invalid timeseries buckets collections prevent completion of FCV 8.0 upgrade时间序列桶集合无效,无法完成FCV 8.0升级 - SERVER-99345
Prevent sharding/moving a time-series buckets collection without the 'timeseries' options on FCV 8.0+在FCV 8.0+上没有“时间序列”选项的情况下,防止分片/移动时间序列桶集合+ - SERVER-106748
Pre-auth denial of service when accepting OIDC authentication接受OIDC身份验证时的预身份验证拒绝服务 - SERVER-106749
Pre-authentication Denial of Service Stack Overflow Vulnerability in JSON Parsing via Excessive Recursion in MongoDBMongoDB中过度递归JSON解析中的预认证拒绝服务堆栈溢出漏洞 - WT-12846
Fix how compact walk handles EBUSY from checkpoint flush_lock修复compact walk如何从检查点flush_lock处理EBUSY All Jira issues closed in 8.0.5所有Jira问题都在8.0.5中关闭- 8.0.5 Changelog
8.0.4 - Dec 9, 2024
- SERVER-73641
Time series filtering can miss extended-range events when sharded分片时,时间序列筛选可能会错过扩展范围事件 - SERVER-82037
Memory used by sorter spills can grow without bound分拣机溢出使用的内存可以无限增长 - SERVER-94559
Time series measurement deletes update the minTime of a bucket时间序列测量删除更新桶的minTime - SERVER-95067
Time series inserts can generate multiple batches referencing the same bucket时间序列插入可以生成引用同一桶的多个批次 - SERVER-95724
ReshardingOplogSessionApplication clones retryable applyOps session info with admin.$cmd as affectedNamespace使用admin.$cmd重新存储OplogSessionApplication克隆可重试的applyOps会话信息,作为受affectedNamespace(影响命名空间) All Jira issues closed in 8.0.4所有Jira问题已在8.0.4中关闭- 8.0.4 Changelog
8.0.3 - Oct 24, 2024
Important
Improper neutralization of null bytes may lead to buffer over-reads in MongoDB Server空字节的不正确中和可能会导致MongoDB服务器中的缓冲区过度读取
In MongoDB 8.0 and 8.0.1, an authorized user may trigger crashes or receive the contents of buffer over-reads of Server memory by issuing specially crafted requests that construct malformed BSON in the MongoDB Server.在MongoDB 8.0和8.0.1中,授权用户可以通过发出在MongoDB服务器中构造格式错误的BSON的特制请求来触发崩溃或接收服务器内存读取缓冲区的内容。
This issue affects MongoDB Server versions:此问题影响MongoDB服务器版本:
- 5.0.0 - 5.0.29
- 6.0.0 - 6.0.18
- 7.0.0 - 7.0.14
- 8.0.0 - 8.0.1
Issues fixed:已解决的问题:
- SERVER-96419
Improper neutralization of null bytes may lead to buffer over-reads in MongoDB Server空字节的不正确中和可能会导致MongoDB服务器中的缓冲区过度读取 All Jira issues closed in 8.0.3所有Jira问题已在8.0.3中关闭- 8.0.3 Changelog
8.0.1 - Oct 9, 2024
Issues fixed:已解决的问题:
- SERVER-76883
Reduce chattiness of "Role does not exist" logs for externally sourced users减少外部用户对“角色不存在”日志的闲聊 - SERVER-82221
listCollections and listIndexes should include commit-pending namespaceslistCollections和listIndexes应包含待提交命名空间 - SERVER-94635
Make session refresh parameters configurable使会话刷新参数可配置 - SERVER-95244
Upsert statements which result in an insert may fail with tassert 9146500 when client connects directly to shard当客户端直接连接到分片时,导致插入的Upsert语句可能会因tassert 9146500而失败 - WT-13409
One ret in __txn_checkpoint is not handled__txn_checkpoint中的一个ret未处理 All Jira issues closed in 8.0.1所有Jira问题已在8.0.1中关闭- 8.0.1 Changelog
8.0.0 - Oct 2, 2024
The rest of this page describes changes and new features introduced in MongoDB 8.0.本页其余部分描述了MongoDB 8.0中引入的更改和新功能。
Performance Improvements性能改进
MongoDB 8.0 introduces significant performance improvements from MongoDB 7.0, including, but not limited to:MongoDB 8.0从MongoDB 7.0引入了显著的性能改进,包括但不限于:
Up to 36% better read throughput.读取吞吐量提高36%。Up to 32% better performance for typical web applications.典型web应用程序的性能提高了32%。Up to 20% faster concurrent writes during replication.复制期间并发写入速度提高了20%。
Note
The amount of performance improvement can vary depending on the configuration of your workloads and database instances.性能提升的幅度可能因工作负载和数据库实例的配置而异。
New Bulk Write Command新建批量写入命令
Starting in MongoDB 8.0, you can use the new 从MongoDB 8.0开始,您可以使用新的bulkWrite command to perform many insert, update, and delete operations on multiple collections in one request. bulkWrite命令在一个请求中对多个集合执行许多插入、更新和删除操作。The existing 现有的db.collection.bulkWrite() method only allows you to modify one collection in one request.db.collection.bulkWrite()方法只允许您在一个请求中修改一个集合。
MongoDB 8.0上的bulkWrite operations on MongoDB 8.0 can run up to 56% faster than bulk write operations on MongoDB 7.0.bulkWrite操作比MongoDB 7.0上的批量写操作快56%。
Time Series Block Processing时间序列块处理
Starting in version 8.0, MongoDB may execute certain time series queries using block processing. This performance improvement processes queries in "blocks" of data, rather than individual values. Block processing improves query execution speed and throughput when working with time series collections.从8.0版本开始,MongoDB可以使用块处理执行某些时间序列查询。这种性能改进以数据的“块”而不是单个值来处理查询。在处理时间序列集合时,块处理可以提高查询执行速度和吞吐量。
Compared to time series queries run on MongoDB 7.0 or earlier, block processing for time series data in MongoDB 8.0 may handle higher volumes of data and improve throughput in some cases by more than 200% for 与在MongoDB 7.0或更早版本上运行的时间序列查询相比,MongoDB 8.0中时间序列数据的块处理可以处理更大的数据量,在某些情况下,对于$group operations and analytical queries.$group操作和分析查询,吞吐量可以提高200%以上。
To see if your time series query uses block processing, check the 要查看您的时间序列查询是否使用块处理,请检查解释计划输出中的explain.queryPlanner.winningPlan.slotBasedPlan.stages field in the explain plan output.explain.queryPlanner.winningPlan.slotBasedPlan.stages字段。
To learn more, see Block Processing.要了解更多信息,请参阅块处理。
Platform Support Updates平台支持更新
Starting in MongoDB 8.0, new MongoDB Server versions (major and minor) support the minimum operating system (OS) minor version defined by the OS vendor. After an OS minor version is no longer supported by the OS vendor, MongoDB updates the MongoDB Server to support the next OS minor version. 从MongoDB 8.0开始,新的MongoDB Server版本(主要和次要)支持操作系统供应商定义的最低操作系统(OS)次要版本。在操作系统供应商不再支持某个操作系统次要版本后,MongoDB会更新MongoDB服务器以支持下一个操作系统较小版本。For details, see MongoDB Platform Support Improvements.有关详细信息,请参阅MongoDB平台支持改进。
MongoDB 8.0 supports the following minimum OS minor versions:MongoDB 8.0支持以下最低操作系统次要版本:
Red Hat Enterprise Linux 8.8红帽企业Linux 8.8Red Hat Enterprise Linux 9.3红帽企业Linux 9.3SUSE Linux Enterprise Server 15 SP5SUSE Linux企业服务器15 SP5Amazon Linux 2023 version 2023.3亚马逊Linux 2023版本2023.3
Logging日志记录
Starting in MongoDB 8.0, you can configure the Database Profiler to log slow operations based on the time that MongoDB spends working on that operation, rather than the total latency for the operation. This means that factors such as waiting for locks and flow control do not affect whether an operation exceeds the slow operation threshold.从MongoDB 8.0开始,您可以将数据库分析器配置为根据MongoDB在该操作上花费的时间而不是操作的总延迟来记录慢速操作。这意味着等待锁和流量控制等因素不会影响操作是否超过慢速操作阈值。
This change provides the following improvements for logging and query analysis:此更改为日志记录和查询分析提供了以下改进:
Slow queries are logged more accurately based on the time MongoDB spends processing the query.根据MongoDB处理查询所花费的时间,慢速查询会被更准确地记录下来。Query analysis tools such as the Query Profiler, Performance Advisor, and Search Query Telemetry report slow operations based on查询分析器、性能顾问和搜索查询遥测等查询分析工具根据workingMillisinstead ofdurationMillis. This change provides a more accurate view of problematic queries.workingMillis(工作毫秒)而不是durationMillis(持续毫秒)报告缓慢的操作。此更改为有问题的查询提供了更准确的视图。Slow query logs include a metric for the time queued on execution tickets,慢速查询日志包括执行票排队时间的度量,即queues.execution.totalTimeQueuedMicros. This metric helps identify whether an operation is slow because of the time it takes to complete, or the time it spends waiting to start.queues.execution.totalTimeQueuedMicros。此指标有助于确定操作是否因为完成所需的时间或等待开始所花费的时间而变慢。
For more information, see 有关更多信息,请参阅db.setProfilingLevel().db.setProfilingLevel()。
Database Profiler数据库分析器
When you specify a filter for the database profiler, you can log operations based on the new 为数据库分析器指定筛选器时,可以根据新的workingMillis metric. You can log operations based on both workingMillis and durationMillis and set each metric to a different threshold.workingMillis(工作毫秒)度量记录操作。您可以根据工作毫秒和持续时间毫秒记录操作,并将每个指标设置为不同的阈值。
Aggregation聚合
BinData Conversion二进制数据转换
Starting in MongoDB 8.0, you can use the 从MongoDB 8.0开始,您可以使用$convert operator to perform the following conversions:$convert运算符执行以下转换:
String values to binData values将字符串值转换为binData值binData values to string valuesbinData值到字符串值
MongoDB 8.0 also includes a new helper expression, MongoDB 8.0还包括一个新的辅助表达式$toUUID, which provides simplified syntax for converting strings to UUID values.$toUUID,它提供了将字符串转换为UUID值的简化语法。
$queryStats
Starting in MongoDB 7.1, the 从MongoDB 7.1开始,$queryStats stage returns statistics for recorded queries.$queryStats阶段返回已记录查询的统计信息。
Change Stream Improvements更改流改进
Starting in MongoDB 8.0, 从MongoDB 8.0开始,$queryStats improves tracking and reporting metrics for change streams. $queryStats改进了变更流的跟踪和报告指标。For more information, see $queryStats Change Streams Behavior.有关更多信息,请参阅$queryStats更改流行为。
$rank and $denseRank Behavior$rank和$denseRank行为
Starting in MongoDB 8.0, 从MongoDB 8.0开始,在计算排名时,null and missing field values in $denseRank and $rank sortBy operations are treated the same when calculating rankings. $denseRank和$rank sortBy操作中的null和缺失字段值被视为相同。This change makes the behavior of 此更改使denseRank and rank consistent with $sort.denseRank和rank的行为与$sort一致。
Security安全
Queryable Encryption Range Queries可查询的加密范围查询
Starting in MongoDB 8.0, Queryable Encryption supports range queries on encrypted fields using the 从MongoDB 8.0开始,可查询加密支持使用$lt, $lte, $gt, and $gte operators. $lt、$lte、$gt和$gte运算符对加密字段进行范围查询。For details, see Supported Operations for Queryable Encryption. To enable range queries on encrypted fields, see Create an Encryption Schema.有关详细信息,请参阅可查询加密的支持操作。要在加密字段上启用范围查询,请参阅创建加密架构。
OCSF Schema for Log Messages日志消息的OCSF架构
Starting in MongoDB 8.0, you can specify the OCSF schema for audit log messages. The OCSF schema provides logs in a standardized format compatible with log processors.从MongoDB 8.0开始,您可以为审计日志消息指定OCSF模式。OCSF模式以与日志处理器兼容的标准化格式提供日志。
To set the schema used for log messages, use the 要设置用于日志消息的架构,请使用auditLog.schema configuration file option.auditLog.schema配置文件选项。
For example log messages in OCSF format, see OCSF Schema Audit Messages.例如,OCSF格式的日志消息,请参阅OCSF架构审核消息。
Ingress Queue入口队列
MongoDB 8.0 introduces a new queue for ingress admission control. Operations that wait for entry into the database from the network enter the ingress queue. By default, the queue is unrestricted, meaning that MongoDB allows all operations to execute through this stage without any queueing. Setting the queue maximum to a specific value allows you to queue operations at this stage if the number of concurrent operations reaches the specified limit.MongoDB 8.0引入了一个新的入口准入控制队列。等待从网络进入数据库的操作进入入口队列。默认情况下,队列是不受限制的,这意味着MongoDB允许所有操作在此阶段执行,而无需任何排队。将队列最大值设置为特定值,允许您在并发操作数量达到指定限制时在此阶段对操作进行排队。
Sharding分片
Starting in MongoDB 8.0, you can unshard collections and move unsharded collections between shards on sharded clusters.从MongoDB 8.0开始,您可以取消对集合的划分,并在分片集群上的分片之间移动未划分的集合。
Moving a Collection移动集合
Starting in MongoDB 8.0, you can move an unsharded collection to a different shard using the 从MongoDB 8.0开始,您可以使用moveCollection command.moveCollection命令将未分片的集合移动到其他分片。
For details, see Moveable Collections. To get started, see Move a Collection.有关详细信息,请参阅可移动集合。要开始,请参阅移动集合。
Moving Collections that have Change Streams移动具有变更流的集合
Starting in MongoDB 8.0, 从MongoDB 8.0开始,movePrimary doesn't invalidate Event collections that have change streams. The change streams can continue to read events from collections after the collections are moved to a new shard.movePrimary不会使具有更改流的事件集合无效。在集合被移动到新的分片后,更改流可以继续从集合中读取事件。
For details, see Moving Collections that have Change Streams.有关详细信息,请参阅移动具有更改流的集合。
Unsharding a Collection打开集合
Starting in MongoDB 8.0, you can unshard existing sharded collections with the 从MongoDB 8.0开始,您可以使用unshardCollection command or the sh.unshardCollection() method. unshardCollection命令或sh.unshardCollection()方法取消对现有分片集合的分区。This operation moves all documents in the collection onto a specified shard or the shard with the least amount of data.此操作将集合中的所有文档移动到指定的分片或数据量最少的分片上。
For details, see Unsharded Collections. To get started, see Unshard a Collection.有关详细信息,请参阅未分片集合。要开始,请参阅取消分片集合。
Config Shards配置分片
Starting in MongoDB 8.0, you can configure a config server to store your application data in addition to the usual sharded cluster metadata. 从MongoDB 8.0开始,您可以配置配置服务器来存储应用程序数据以及通常的分片集群元数据。A 同时提供配置服务器和分片服务器功能的mongod node that provides both config server and shard server functionality is called a config shard. mongod节点称为配置分片。A 没有分片服务器功能的mongod node that runs as a standalone --configsvr without shard server functionality is called a dedicated config server.mongod节点作为独立的--configsvr运行,称为专用配置服务器。
To configure a dedicated config server to run as a config shard, run the 要将专用配置服务器配置为作为配置分片运行,请运行transitionFromDedicatedConfigServer command.transitionFromDedicatedConfigServer命令。
To configure a config shard to run as a dedicated config server, run the 要将配置分片配置为作为专用配置服务器运行,请运行transitionToDedicatedConfigServer command.transitionToDedicatedConfigServer命令。
For details, see Config Shard. To get started, see Start a Sharded Cluster with a Config Shard. 有关详细信息,请参阅配置分片。要开始,请参阅使用配置分片启动分片集群。To convert a replica set to a sharded cluster with a config shard, see Convert a Replica Set to a Sharded Cluster with an Embedded Config Server.要将副本集转换为具有配置分片的分片集群,请参阅使用嵌入式配置服务器将副本集转化为分片集群。
New Database Commands新建数据库命令
New mongosh Methods新mongosh方法
serverStatus Metrics服务器状态指标
Starting in MongoDB 8.0, 从MongoDB 8.0开始,serverStatus includes the following new shardingStatistics fields in its output:serverStatus在其输出中包括以下新的shardingStatistics字段:
shardingStatistics.countTransitionToDedicatedConfigServerStartedshardingStatistics.countTransitionToDedicatedConfigServerCompletedshardingStatistics.countTransitionFromDedicatedConfigServerCompletedshardingStatistics.configServerInShardCache
MongoDB 7.1 includes the following new sharding statistics for chunk migrations:MongoDB 7.1包括以下用于块迁移的新分片统计信息:
shardingStatistics.countDonorMoveChunkCommittedshardingStatistics.countDonorMoveChunkAbortedshardingStatistics.totalDonorMoveChunkTimeMillisshardingStatistics.countBytesClonedOnRecipientshardingStatistics.countDocsClonedOnCatchUpOnRecipientshardingStatistics.countBytesClonedOnCatchUpOnRecipient
Default Chunks Per Shard每个分片的默认块数
Starting in MongoDB 7.2, when you shard an empty collection with a hashed shard key, the operation creates one chunk per shard by default. Previously, the operation created two chunks by default.从MongoDB 7.2开始,当您使用哈希分片键对空集合进行分片时,默认情况下,该操作会为每个分片创建一个块。以前,该操作默认创建了两个块。
directShardOperations Role角色
Starting in MongoDB 8.0, you can use the 从MongoDB 8.0开始,您可以使用directShardOperations role to perform maintenance operations that require you to execute commands directly against a shard.directShardOperations角色执行维护操作,这些操作要求您直接对分片执行命令。
Warning
Running commands using the 使用directShardOperations role can cause your cluster to stop working correctly and may cause data corruption. Only use the directShardOperations role for maintenance purposes or under the guidance of MongoDB support. directShardOperations角色运行命令可能会导致集群停止正常工作,并可能导致数据损坏。仅将directShardOperations角色用于维护目的或在MongoDB支持的指导下使用。Once you are done performing maintenance operations, stop using the 完成维护操作后,停止使用directShardOperations role.directShardOperations角色。
dbhash Can Run Directly on a Sharddbhash可以直接在分片上运行
Starting in MongoDB 8.0.5, you can run 从MongoDB 8.0.5开始,您可以直接在分片上运行dbHash directly on a shard. For a full list of shard direct commands, see Shard Direct Commands.dbHash。有关分片直接命令的完整列表,请参阅分片直接指令。
Exhaust Cursors Enabled for Sharded Clusters为分片集群启用排气游标
Starting in MongoDB 7.1, 从MongoDB 7.1开始,当客户端的getMore请求设置了mongos supports exhaust cursors when a client's getMore request sets the exhaustAllowed flag. exhaustAllowed标志时,mongos支持exhaust游标。This can improve query performance on sharded clusters when the client receives multiple replies from the database server for a single request.当客户端从数据库服务器收到单个请求的多个回复时,这可以提高分片集群上的查询性能。
mongos Port Range蒙古港范围
Starting in MongoDB 7.1, 从MongoDB 7.1开始,mongos accepts --port values from [0, 65535]. For more information, see --port.mongos接受[0,65535]中的--port值。有关更多信息,请参阅--port。
Query with Partial Shard Key使用部分分片键进行查询
Starting in MongoDB 7.1, 从MongoDB 7.1开始,findAndModify and deleteOne() can use a partial shard key to query on a sharded collection.findAndModify和deleteOne()可以使用部分分片键来查询分片集合。
Resharding Improvements重新硬装改进
MongoDB 8.0 introduces significant performance improvements in resharding operations, substantially reducing the amount of time the operation takes to run.MongoDB 8.0在重新标记操作中引入了显著的性能改进,大大减少了操作运行所需的时间。
Additionally, if your application and cluster meet the necessary requirements and limitations, you can reshard the collection on the same key using the 此外,如果您的应用程序和集群满足必要的要求和限制,您可以使用reshardCollection command to redistribute your collection, which is much faster than alternative range migration procedure.reshardCollection命令在同一键上重新标记集合以重新分发您的集合,这比其他范围迁移过程快得多。
The following options are added to the command:以下选项将添加到命令中:
forceRedistribution |
For examples, see Redistribute Data to New Shards.有关示例,请参阅将数据重新分配到新分片。
Self-Managed Backups of Sharded Clusters分片集群的自我管理备份
Starting in MongoDB 7.1, the 从MongoDB 7.1开始,fsync and fsyncUnlock commands can perform fsync operations on sharded clusters.fsync和fsyncUnlock命令可以在分片集群上执行fsync操作。
When run on 当在mongos with the lock field set to true, the fsync command flushes writes from the storage layer to disk and locks each shard, preventing additional writes. mongos上运行并将lock字段设置为true时,fsync命令会将写入从存储层刷新到磁盘并锁定每个分片,从而防止额外的写入。The 然后,可以使用fsyncUnlock command can then be used to unlock the cluster.fsyncUnlock命令解锁集群。
This feature enables self-managed backups of sharded clusters using 此功能允许使用mongodump.mongodump对分片集群进行自我管理备份。
UpdateOne upsert Behavior on Sharded CollectionsUpdateOne对分片化集合的扰乱行为
Starting in MongoDB 7.1, when using 从MongoDB 7.1开始,当在分片集合上使用updateOne() with upsert: true on a sharded collection, you do not need to include the full shard key in the filter.updateOne()和upsert:true时,您不需要在筛选器中包含完整的分片键。
$lookup Stage in Transactions with Sharded Collections分片集合事务中的$lookup阶段
Starting in MongoDB 8.0, you can use the 从MongoDB 8.0开始,您可以在事务中使用$lookup stage within a transaction while targeting a sharded collection.$lookup阶段,同时针对分片集合。
Replication复制
Majority Write Concern多数人写担忧
Starting in MongoDB 8.0, write operations that use the 从MongoDB 8.0开始,当大多数副本集成员已经为更改写入oplog条目时,使用"majority" write concern return an acknowledgment when the majority of replica set members have written the oplog entry for the change. "majority"写入关注的写入操作会返回确认。This improves the performance of 这提高了"majority" writes. In previous releases, these operations would wait and return an acknowledgment after the majority of replica set members applied the change."majority"写入的性能。在以前的版本中,这些操作将在大多数副本集成员应用更改后等待并返回确认。
If your application reads from a secondary immediately after receiving an acknowledgment from a 如果您的应用程序在收到{ w: "majority" } write operation (without a causally consistent session), the query may return results that don't include changes from the write.{ w: "majority" }写入操作的确认后立即从辅助服务器读取(没有因果一致的会话),则查询可能会返回不包括写入更改的结果。
New replSetGetStatus Metrics新replSetGetStatus指标
Starting in MongoDB 8.0, the following metrics are available when using the 从MongoDB 8.0开始,使用replSetGetStatus command:replSetGetStatus命令时可以使用以下指标:
replSetGetStatus.electionCandidateMetrics.lastSeenWrittenOpTimeAtElectionreplSetGetStatus.electionParticipantMetrics.lastWrittenOpTimeAtElectionreplSetGetStatus.electionParticipantMetrics.maxWrittenOpTimeInSetreplSetGetStatus.members[n].optimeWrittenreplSetGetStatus.members[n].optimeWrittenDatereplSetGetStatus.members[n].lastWrittenWallTimereplSetGetStatus.optimeWrittenreplSetGetStatus.optimeWrittenDatereplSetGetStatus.optimes.lastWrittenWallTimereplSetGetStatus.optimes.writtenOpTime
Oplog BuffersOplog缓冲区
Starting in MongoDB 8.0, secondaries write and apply oplog entries for each batch in parallel. A writer thread reads new entries from the primary and writes them to the local oplog. An applier thread asynchronously applies these changes to the local database. This changes increases replication throughput for secondaries.从MongoDB 8.0开始,二级服务器并行为每个批写入和应用oplog条目。writer线程从主线程读取新条目并将其写入本地oplog。应用程序线程异步地将这些更改应用于本地数据库。此更改增加了辅助服务器的复制吞吐量。
This introduces a breaking change for 这为metrics.repl.buffer, as it now provides metrics on two buffers instead of one.metrics.repl.buffer带来了突破性的变化,因为它现在在两个缓冲区而不是一个缓冲区上提供度量。
MongoDB 8.0 deprecates the following server status metrics:MongoDB 8.0不支持以下服务器状态指标:
MongoDB 8.0 adds the following server status metrics:MongoDB 8.0增加了以下服务器状态指标:
metrics.repl.buffer.applymetrics.repl.buffer.apply.countmetrics.repl.buffer.apply.maxCountmetrics.repl.buffer.apply.maxSizeBytesmetrics.repl.buffer.apply.sizeBytesmetrics.repl.buffer.writemetrics.repl.buffer.write.countmetrics.repl.buffer.write.maxSizeBytesmetrics.repl.buffer.write.sizeBytesmetrics.repl.writemetrics.repl.write.batchSizemetrics.repl.write.batchesmetrics.repl.write.batches.nummetrics.repl.write.batches.totalMillis
Upgraded TCMalloc升级TCMalloc
Starting in MongoDB 8.0, MongoDB uses an upgraded version of TCMalloc that uses per-CPU caches, instead of per-thread caches, to reduce memory fragmentation and make your database more resilient to high-stress workloads.从MongoDB 8.0开始,MongoDB使用TCMalloc的升级版本,该版本使用每CPU缓存,而不是每线程缓存,以减少内存分片,使您的数据库更能适应高压力的工作负载。
The new TCMalloc version directly impacts previous production recommendations for Transparent Huge Pages. To learn more, see TCMalloc Performance Optimization for a Self-Managed Deployment.新的TCMalloc版本直接影响了之前对透明巨型页面的生产建议。要了解更多信息,请参阅TCMalloc自我管理部署的性能优化。
serverStatus Metrics指标
Starting in MongoDB 8.0, the following new 从MongoDB 8.0开始,以下新的serverStatus metrics report information about tcmalloc usage:serverStatus指标报告了有关tcmalloc使用情况的信息:
General Changes一般变更
Shutdown Performance关机性能
Starting in MongoDB 8.0, 从MongoDB 8.0开始,Bulk.insert() and data ingestion workloads may perform better. However, shutting down MongoDB immediately after running these workloads might take longer because of the extra data being flushed to disk.Bulk.insert()和数据摄取工作负载可能会表现更好。然而,在运行这些工作负载后立即关闭MongoDB可能需要更长的时间,因为额外的数据会被刷新到磁盘。
Store Application Data on Config Shards将应用程序数据存储在配置分片上
Starting in MongoDB 8.0, you can configure a config server to store application data in addition to the usual sharded cluster metadata. The config server is then known as a config shard. 从MongoDB 8.0开始,您可以配置配置服务器来存储应用程序数据,以及通常的分片集群元数据。配置服务器被称为“配置分片”。For details, see Config Shards.有关详细信息,请参阅配置分片。
Compaction Improvements压实改进
Starting in MongoDB 7.3, the 从MongoDB 7.3开始,compact command includes a new freeSpaceTargetMB option to specify the minimum amount of storage space, in megabytes, that must be recoverable for compaction to proceed.compact命令包括一个新的freeSpaceTargetMB选项,用于指定压缩必须恢复的最小存储空间量(以兆字节为单位)。
Background Compaction后台压缩
Starting in MongoDB 8.0, you can use the new 从MongoDB 8.0开始,您可以使用新的autoCompact command to perform background compaction. autoCompact命令执行后台压缩。If enabled, the server attempts to keep free space within each collection and index below the specified the 如果启用,服务器将尝试将每个集合和索引中的可用空间保持在指定的freeSpaceTargetMB value.freeSpaceTargetMB值以下。
dryRun Option选项
If enabled, the 如果启用,compact command returns an estimate of how much space, in bytes, compaction can reclaim from the targeted collection. compact命令将返回压缩可以从目标集合中回收多少空间(以字节为单位)的估计值。If you run 如果你在compact with dryRun set to true, MongoDB only returns the estimated value and does not perform any kind of compaction.dryRun设置为true的情况下运行compact,MongoDB只会返回估计值,不会执行任何类型的压缩。
Concurrent DDL Operations并发DDL操作
Starting in MongoDB 7.1, when you run multiple DDL operations that target different collections from the same database, MongoDB runs those operations concurrently.从MongoDB 7.1开始,当您运行针对同一数据库中不同集合的多个DDL操作时,MongoDB会同时运行这些操作。
This change adds two new types to the 此更改为serverStatus locks field and currentOp.locks output:serverStatus locks字段和currentOp.locks输出添加了两种新类型:
DDLDatabaseDDLCollection
Database Validation on mongos Aggregation Queriesmongos聚合查询的数据库验证
Starting in MongoDB 7.2, aggregation pipeline queries that attempt to use non-existent databases on mongos deployments return validation errors.从MongoDB 7.2开始,试图在mongos部署上使用不存在的数据库的聚合管道查询会返回验证错误。
In previous versions, these aggregation queries return empty cursors.在以前的版本中,这些聚合查询返回空游标。
DDL OperationsDDL操作
In MongoDB 8.0, if you add or remove a shard while your cluster executes a DDL operation (operation that modifies a collection such as 在MongoDB 8.0中,如果在集群执行DDL操作(修改集合(如reshardCollection), any operation that adds or removes a shard only executes after the concurrent DDL operation finishes.reshardCollection)的操作)时添加或删除分片,则任何添加或删除分片的操作都只能在并发DDL操作完成后执行。
Error Codes for Exceeding Pipeline Size Limit超出管道尺寸限制的错误代码
Starting in MongoDB 7.1, an aggregation command will throw an error when a pipeline exceeds the pipeline stage limit. For more details, see Number of Stages Restrictions.从MongoDB 7.1开始,当管道超过管道阶段限制时,聚合命令将抛出错误。有关更多详细信息,请参阅阶段数限制。
getField Field Supports All Strings字段支持所有字符串
Starting in MongoDB 7.2, you can specify any valid expression that resolves to a string for the 从MongoDB 7.2开始,您可以为field input of the $getField operator. $getField运算符的field输入指定任何解析为字符串的有效表达式。In earlier versions, 在早期版本中,字段只接受字符串常量。field accepts only string constants.
Improved Index Builds改进索引构建
Starting in MongoDB 7.1, index builds are improved with faster error reporting and increased failure resilience. 从MongoDB 7.1开始,索引构建得到了改进,错误报告更快,故障恢复能力更强。You can also set the minimum available disk space required for index builds using the new 您还可以使用新的indexBuildMinAvailableDiskSpaceMB parameter, which stops index builds if disk space is too low.indexBuildMinAvailableDiskSpaceMB参数设置索引构建所需的最小可用磁盘空间,如果磁盘空间太低,该参数将停止索引构建。
The following new index build metrics were added:添加了以下新的索引构建指标:
For full details, see Index Builds.有关完整详细信息,请参阅索引构建。
New Parameters参数
auditConfig Parameter参数
MongoDB 7.1 adds the MongoDB 7.1添加了auditConfig cluster parameter, which contains information on audit configurations from mongod and mongos server instances.auditConfig集群参数,其中包含mongod和mongos服务器实例的审计配置信息。
defaultMaxTimeMS Parameter参数
Starting in MongoDB 8.0, you can use the 从MongoDB 8.0开始,您可以使用defaultMaxTimeMS cluster parameter to specify a default time limit for individual read operations to complete.defaultMaxTimeMS集群参数为完成单个读取操作指定默认时间限制。
indexBuildMinAvailableDiskSpaceMB Parameter参数
MongoDB 7.1 adds the MongoDB 7.1添加了indexBuildMinAvailableDiskSpaceMB parameter, which allows you to set the minimum available disk space required for index builds.indexBuildMinAvailableDiskSpaceMB参数,该参数允许您设置索引构建所需的最小可用磁盘空间。
tcmallocEnableBackgroundThread Parameter参数
Starting in MongoDB 8.0, the 从MongoDB 8.0开始,默认情况下启用tcmallocEnableBackgroundThread is enabled by default. This allows MongoDB to periodically release memory back to the operating system.tcmallocEnableBackgroundThread。这允许MongoDB定期将内存释放回操作系统。
New Query Shape and Query Settings新建查询形状和查询设置
MongoDB 8.0 introduces a new query shape. The pre-existing query shape is renamed as the plan cache query shape.MongoDB 8.0引入了一种新的查询形状。预先存在的查询形状将重命名为计划缓存查询形状。
Starting in MongoDB 8.0, you can add query settings for the new query shape. 从MongoDB 8.0开始,您可以为新的查询形状添加查询设置。The query optimizer uses the query settings as an additional input during query planning, which affects the plan selected to run a query that has a matching query shape.查询优化器在查询规划期间使用查询设置作为额外输入,这会影响为运行具有匹配查询形状的查询而选择的计划。
Query settings have improved functionality compared to index filters. Index filters are also deprecated starting in MongoDB 8.0, and you should avoid using them.与索引筛选器相比,查询设置的功能得到了改进。从MongoDB 8.0开始,索引筛选器也被弃用,你应该避免使用它们。
To add query settings, use the要添加查询设置,请使用setQuerySettingscommand.setQuerySettings命令。To delete query settings, use the要删除查询设置,请使用removeQuerySettingscommand.removeQuerySettings命令。To retrieve query settings, use a要检索查询设置,请在聚合管道中使用$querySettingsstage in an aggregation pipeline.$querySettings阶段。To block a query shape, see operation rejection filters.要阻止查询形状,请参阅操作拒绝筛选器。To set the log verbosity level for rejected queries, use the要为被拒绝的查询设置日志详细程度,请使用systemLog.component.query.rejected.verbosityparameter.systemLog.component.query.rejected.verbosity参数。
Starting in MongoDB 8.0, 从MongoDB 8.0开始,queryShapeHash is included in the following output:queryShapeHash包含在以下输出中:
explaincommand in theexplain.queryShapeHashfieldexplain.queryShapeHash字段中的explain命令database profiler in thesystem.profile.queryShapeHashfieldsystem.profile.queryShapeHash字段中的数据库分析器$currentOp aggregation pipeline stage in the$currentOp.queryShapeHashfield$currentOp.queryShapeHash字段中的$currentOp聚合管道阶段slow query log慢速查询日志$queryStatsstage in thequeryShapeHashfieldqueryShapeHash字段中的$queryStats阶段
Starting in MongoDB 8.0, the existing 从MongoDB 8.0开始,现有的queryHash field is duplicated in a new field named planCacheShapeHash. If you're using an earlier MongoDB version, you'll only see the queryHash field. queryHash字段被复制到一个名为planCacheShapeHash的新字段中。如果你使用的是早期的MongoDB版本,你只会看到queryHash字段。Future MongoDB versions will remove the deprecated 未来的MongoDB版本将删除弃用的queryHash field, and you'll need to use the planCacheShapeHash field instead.queryHash字段,您将需要使用planCacheShapeHash字段。
numInitialChunks Option Removed选项已删除
Starting in MongoDB 7.2, the 从MongoDB 7.2开始,从numInitialChunks option is removed from the shardCollection command. shardCollection命令中删除numInitialChunks选项。The server automatically creates chunks on every shard in a cluster when using hashed sharding for an empty collection.当对空集合使用哈希分片时,服务器会自动在集群中的每个分片上创建块。
Parameter Filtering参数筛选
Starting in MongoDB 8.0, the 从MongoDB 8.0开始,getParameter command accepts a setAt field. getParameter命令接受setAt字段。You can use this field to filter the 您可以使用此字段筛选allParameters: true return document to show only those parameters that you can set at startup or runtime.allParameters:true返回文档,仅显示您可以在启动或运行时设置的参数。
Read Concern on Capped Collections关于封顶集合的读取关注
Starting in MongoDB 8.0, you can use read concern 从MongoDB 8.0开始,您可以在封顶集合上使用读取关注"snapshot" on capped collections."snapshot"。
serverStatus Output Change输出更改
Starting in MongoDB 7.1, the 从MongoDB 7.1开始,serverStatus command output includes the following new metrics:serverStatus命令输出包括以下新指标:
Starting in MongoDB 7.2, the 从MongoDB 7.2开始,serverStatus command output includes the following new metrics:serverStatus命令输出包括以下新指标:
Starting in MongoDB 7.3, the 从MongoDB 7.3开始,serverStatus command output includes the following new metrics:serverStatus命令输出包括以下新指标:
metrics.repl.stateTransition.totalOperationsRunningmetrics.repl.stateTransition.totalOperationsKilledmetrics.repl.waiters.replicationmetrics.repl.waiters.opTimeplanCache.classic.skippedplanCache.sbe.skipped
Starting in MongoDB 8.0, the 从MongoDB 8.0开始,serverStatus command output includes the following new metrics:serverStatus命令输出包括以下新指标:
Sort Option选项
Starting in MongoDB 8.0, 从MongoDB 8.0开始,updateOne(), replaceOne(), and update have an optional sort field to order documents before applying an update.updateOne()、replaceOne()和update都有一个可选的sort字段,用于在应用更新之前对文档进行排序。
Previous releases use the 以前的版本使用findAndModify() and findOneAndUpdate() methods to update the first document in a user-specified sort order. findAndModify()和findOneAndUpdate()方法以用户指定的排序顺序更新第一个文档。Support for retryable writes requires these methods to copy the entire document to a special side collection for each node, which is a more expensive operation than the 支持可重试写入要求这些方法将整个文档复制到每个节点的特殊侧集合中,这是一个比具有新排序选项的updateOne() method with the new sort option.updateOne()方法更昂贵的操作。
Specify Query Index Hints for distinct Commands为不同的命令指定查询索引提示
Starting in MongoDB 7.1, the 从MongoDB 7.1开始,hint field is available in the distinct command, allowing you to specify the query's index.hint字段在distinct命令中可用,允许您指定查询的索引。
TTL IndexesTTL索引
Starting in MongoDB 7.1, you can create TTL indexes on capped collections.从MongoDB 7.1开始,您可以在封顶集合上创建TTL索引。
Query Planning and Execution查询计划和执行
Express Query Stages快速查询阶段
Starting in MongoDB 8.0, a limited set of queries (including 从MongoDB 8.0开始,一组有限的查询(包括_id equality matches) skip regular query planning and execution. Instead, these queries use an optimized index scan plan consisting of one of these plan stages:_id相等匹配)跳过常规查询规划和执行。相反,这些查询使用由以下计划阶段之一组成的优化索引扫描计划:
EXPRESS_CLUSTERED_IXSCANEXPRESS_DELETEEXPRESS_IXSCANEXPRESS_UPDATE
For more information on query plans, see Explain Results.有关查询计划的更多信息,请参阅解释结果。
Rejected Query Plan Output查询计划输出被拒绝
Starting in MongoDB 8.0, rejected query plans only contain the 从MongoDB 8.0开始,被拒绝的查询计划只包含查询的find portion of the query. In previous versions, rejected plans can contain aggregation stages like $group. find部分。在以前的版本中,被拒绝的计划可以包含聚合阶段,如$group。Those aggregation stages aren't used by the query planner to choose the winning plan, so the 查询计划器不使用这些聚合阶段来选择获胜计划,因此rejectedPlans field only contains the portion of the query that was used to choose the winning plan.rejectedPlans字段仅包含用于选择获胜计划的查询部分。
This change also ensures that 此更改还确保了被拒绝计划的executionStats for rejected plans are non-zero. As a result, you can now see statistics such as how many documents or keys a rejected plan examined.executionStats为非零。因此,您现在可以看到统计数据,例如被拒绝的计划检查了多少文档或键。
For more information on rejected query plans, see 有关被拒绝的查询计划的更多信息,请参阅explain.queryPlanner.rejectedPlans.explain.queryPlanner.rejectedPlans。
Slot-Based Execution Engine Disabling禁用基于插槽的执行引擎
Starting in MongoDB 8.0, MongoDB automatically disables slot-based execution engine on collections with an index with a hashed path prefix of a non-hashed path, where both paths are in the index.从MongoDB 8.0开始,MongoDB会自动在索引为非哈希路径的哈希路径前缀的集合上禁用基于槽的执行引擎,其中两个路径都在索引中。
Batch Multi-Document Insert Operations批量多文档插入操作
Starting in MongoDB 8.0, bulk insert operations outside of transactions may no longer produce individual 从MongoDB 8.0开始,事务之外的批量插入操作可能不再产生单个oplog entries. Instead, MongoDB typically batches bulk inserts as a single entry. oplog条目。相反,MongoDB通常将批量插入作为单个条目进行批处理。The change stream 每个文档的更改流insert event for each document has the same clusterTime.insert事件具有相同的clusterTime。
This change increases performance of multi-document insert operations and eliminates possible replication lag caused by multiple 此更改提高了多文档插入操作的性能,并消除了多次oplog writes.oplog写入可能导致的复制延迟。
OIDC Identity Providers Can Share an IssuerOIDC身份提供者可以共享发卡机构
Starting in MongoDB 8.0, when multiple identity providers (IDP) are defined, the 从MongoDB 8.0开始,当定义了多个身份提供者(IDP)时,oidcIdentityProviders parameter accepts duplicate issuer values as long as the audience value is unique for each issuer. oidcIdentityProviders参数接受重复的issuer(颁发者)值,只要每个颁发者的audience值都是唯一的。This is also available in versions 7.3 and 7.0.这在7.3和7.0版本中也可用。
Namespaces in Subpipelines子管道中的命名空间
Starting in MongoDB 8.0, namespaces in subpipelines inside 从MongoDB 8.0开始,$lookup and $unionWith are validated to ensure the correct use of from and coll fields.$lookup和$unionWith内的子管道中的命名空间经过验证,以确保from和coll字段的正确使用。
For details, see $lookup subpipelines and $unionWith subpipelines.有关详细信息,请参阅$lookup子管道和$unionWith子管道。
Query Planner Optimization Time查询计划优化时间
The explain() method now returns information on query planner optimization time. explain()方法现在返回查询计划器优化时间的信息。The queryPlanner.optimizationTimeMillis status shows the time in milliseconds that the query planner spent on optimizations.queryPlanner.optimizationTimeMillis状态显示查询计划器在优化上花费的时间(毫秒)。
Upgrade Procedures升级程序
Important
Feature Compatibility Version功能兼容性版本
To upgrade to MongoDB 8.0 from a 7.0 deployment, the 7.0 deployment must have 要从7.0部署升级到MongoDB 8.0,7.0部署必须将featureCompatibilityVersion set to 7.0. To check the version:featureCompatibilityVersion设置为7.0。要检查版本,请执行以下操作:
db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )To upgrade to MongoDB 8.0, refer to the upgrade instructions specific to your MongoDB deployment:要升级到MongoDB 8.0,请参阅特定于您的MongoDB部署的升级说明:
Upgrade a Standalone to 8.0将单机版升级到8.0Upgrade a Replica Set to 8.0将副本集升级到8.0Upgrade a Sharded Cluster to 8.0将分片集群升级到8.0
If you need guidance on upgrading to 8.0, MongoDB professional services offer major version upgrade support to help ensure a smooth transition without interruption to your MongoDB application. 如果您需要升级到8.0的指导,MongoDB专业服务提供主要版本升级支持,以帮助确保顺利过渡到MongoDB应用程序,而不会中断。To learn more, see MongoDB Consulting.要了解更多信息,请参阅MongoDB咨询。
Download下载
To download MongoDB 8.0, go to the MongoDB Download Center.要下载MongoDB 8.0,请访问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.0-series to a 7.0-series deployment. However, further downgrading that 7.0-series deployment to a 6.0-series deployment is not supported.例如,您可以将8.0系列部署降级为7.0系列部署。但是,不支持将7.0系列部署进一步降级为6.0系列部署。
Downgrade Policy降级政策
Binary downgrades aren't supported for MongoDB Community Edition.MongoDB社区版不支持二进制降级。You cannot downgrade your deployment's FCV to or from a rapid 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,则在没有支持人员帮助的情况下,无法降级企业部署的二进制版本。