For AI agents: a documentation index is available at https://www.mongodb.com/docs/llms.txt — markdown versions of all pages are available by appending .md to any URL path.
Docs Menu

Release Notes for MongoDB 9.0

Issues fixed:

This release contains important security and reliability improvements.

Important

MongoDB 9.0.1 contains a fix for:

For the latest information about MongoDB security updates, see MongoDB Security Bulletins.

Issues fixed:

Starting in MongoDB 9.0, the changeStreamPreImages.purgingJob.docsDeleted and changeStreamPreImages.purgingJob.bytesDeleted serverStatus metrics may report estimates rather than exact values. These estimates occur when size and count information is not available for the config.system.preimages collection. For details, see changeStreamPreImages.

MongoDB 9.0 also adds a new changeStreamPreImages.markerCreation serverStatus document. This document reports metrics related to the pre-image sampling passes that build the initial truncation information used to remove pre-images. For details, see changeStreamPreImages.

Starting in MongoDB 9.0, the server limits the number of concurrently open multi-document transactions for external clients. When the number of open transactions reaches the limit set by the maxConcurrentMultiDocumentTransactions parameter (default 10000), the server rejects new multi-document transactions and returns a TooManyOpenTransactions error. To learn more, see maxConcurrentMultiDocumentTransactions.

Starting in MongoDB 9.0, MongoDB limits the total amount of memory that a single query operation can use. By default, the limit is 1 gigabyte or 20% of the memory available to the server process, whichever is greater. Operations that exceed the limit fail with ExceededMemoryLimit or QueryExceededMemoryLimitNoDiskUseAllowed. In earlier versions, an operation could use an unbounded amount of memory.

The 100 megabyte per-stage memory limit and the spill-to-disk behavior of individual stages are unchanged. To learn more, see Per-Operation Memory Limit.

Starting in MongoDB 9.0, the server-side JavaScript functions ($accumulator, $function, and $where) are no longer deprecated. MongoDB 9.0 re-enables these functions using a WebAssembly (WASM)-based JavaScript engine, which improves security through stronger sandboxing and isolation than prior versions. These functions were previously deprecated in MongoDB 8.0.

Server-side JavaScript is not available on the ppc64le architecture. To learn more, see Server-side JavaScript.

MongoDB 9.0 adds the following serverStatus metrics:

MongoDB 9.0 renames the shardingStatistics.databaseVersionUpdateCounters document, introduced in MongoDB 8.3, to shardingStatistics.databaseShardingMetadataStatistics. MongoDB 9.0 also replaces the fields of the renamed document with a new set of metrics.

MongoDB 9.0 renames the metrics.changeStreams.showExpandedEvents metric to metrics.changeStreams.option.showExpandedEvents. If you monitor the metric by name, update your monitoring to use the new name.

MongoDB 9.0.1 adds the sessionCatalogPartitions parameter, which specifies the number of partitions in the session catalog. Partitioning the session catalog reduces lock contention when there are a large number of sessions.

MongoDB 9.0 adds the following checkMetadataConsistency inconsistency types:

MongoDB 9.0 removes the ShardCatalogCacheCollectionMetadataMismatch inconsistency type.

MongoDB 9.0 adds a performStrictChunkChecksIfBelowThreshold option to the checkMetadataConsistency command. Use this option to set a chunk-count threshold for a shard's chunk comparison. Below the threshold, the command performs a full comparison. At or above it, the command performs a lighter, count-only comparison. For details, see Chunk Check Threshold.

Starting in MongoDB 9.0, when you run a find, aggregate, or listIndexes command on a time series collection, the cursor.ns field in the response returns the user-facing namespace you originally targeted. In previous versions, the server could return the internal namespace.

MongoDB 9.0 deprecates the net.wireObjectCheck configuration option and its corresponding --objcheck and --noobjcheckand CLI arguments. Starting in 9.0, MongoDB validates all BSON objects that the server ingests by default. If the server receives invalid BSON data, MongoDB returns an error.

MongoDB 9.0 introduces a new schema validation level of constraint. With the constraint validation level, MongoDB applies the validation rules to all document inserts and updates, and guarantees that every document in the collection satisfies the rules. For details, see Specify constraint Validation.

MongoDB 9.0 introduces the following mongosh methods:

Note

When you upgrade to 9.0, clusters with more than 5,000 time series collections in a single database may take longer to update and face additional write latency spikes. To reduce this impact, drop or delete any unnecessary time series collections.

Starting in 9.0, MongoDB stores time series collections as a single namespace that contains time series data compressed into buckets. Time series collections are no longer writable non-materialized views.

Starting in MongoDB 9.0, you can rename time series collections with renameCollection.

MongoDB 9.0 updates the $queryStats output to streamline metrics organization. This update includes the following new output fields:

Field
Description

metrics.cursor

A document that contains metrics relevant to the cursor and batching protocol

metrics.queryExec

A document that contains metrics relevant to query execution

metrics.queryPlanner

A document that contains metrics relevant to the query planner

metrics.writes

A document that contains metrics relevant to operation writes

For more information on the new output structure, see $queryStats Output.

Starting in 9.0, MongoDB collections and reports query statistics for update, insert, and delete commands. For details, see update Command Query Shape, insert Command Query Shape, and delete Command Query Shape.

Starting in MongoDB 9.0, $queryStats collects stats by default for both read and write operations. MongoDB collects stats for a sample of operations rather than for every operation. MongoDB samples read operations at the rate set by the internalQueryStatsSampleRate parameter and write operations at the rate set by the internalQueryStatsWriteCmdSampleRate parameter. Both parameters default to 0.01, which samples 1% of operations.

Because $queryStats reports only the operations that MongoDB samples, its output represents a subset of the operations run against your deployment.

Starting in MongoDB 9.0, you can pass a querySettings document directly to the following commands:

These settings apply only to that execution of the command. MongoDB doesn't store the settings on the cluster and doesn't apply them to other queries with the same query shape.

In earlier versions, you could only set query settings with the setQuerySettings command, which stores the settings on the cluster and applies them to every query with the matching query shape.

If a query shape has stored cluster query settings, MongoDB combines those settings with the settings that you pass in the command. If both specify the same field, the stored cluster setting takes precedence.

New in version 9.0.

Starting in MongoDB 9.0, you can override internal server parameters for a single query shape with the queryKnobs query setting. The queryKnobs setting requires feature compatibility version (FCV) 9.0 or later.

For details, see Query Knobs.

New in version 9.0.

Starting in MongoDB 9.0, you can set a maxTimeMS time limit for a single query shape with the setQuerySettings command. The maxTimeMS query setting requires feature compatibility version (FCV) 9.0 or later.

For details, see Command Fields.

Starting in MongoDB 9.0, a dotted path that does not resolve to a non-null value evaluates as null. The new behavior applies when a field in the path holds an empty array, an array of scalar values, or an array that contains a nested array. Comparisons to null that use the $eq, $ne, $in, $nin, $gte, and $lte operators reflect the new semantics. Equality matching in the $lookup stage also reflects the new semantics. Queries that compare a dotted path to null can return different results after you upgrade. For details, see Compatibility Changes in MongoDB 9.0.

MongoDB 9.0 marks the GA of prefix, suffix, and substring queries on encrypted string fields in Queryable Encryption enabled collections. For details, see enable substring queries and Supported Aggregation Expressions.

To use prefix, suffix, or substring queries with mongosh, you must separately download the Automatic Encryption Shared Library 9.0 or later, then specify the library path to mongosh using the --cryptSharedLibPath option.

MongoDB 9.0 adds the useInternalAuthzForX509 parameter. When set to true, clients that authenticate using MONGODB-X509 use internal authorization, even when LDAP authorization is configured. For details, see useInternalAuthzForX509.

MongoDB 9.0 adds the authenticatedMechanism field to the usersInfo command. This optional string field specifies an authentication mechanism to determine which authorization backend usersInfo queries when looking up user authorization information. For details, see usersInfo.

Starting in MongoDB 9.0, mongocryptd is deprecated. Use the Automatic Encryption Shared Library instead. The Automatic Encryption Shared Library replaces mongocryptd and does not require you to start a separate process. For details, see Install and Configure a CSFLE Query Analysis Component and Install and Configure a Query Analysis Component.

MongoDB 9.0 adds the directRemote field to audit messages in the mongo schema and the direct_endpoint field to audit messages in the OCSF schema. These fields record the literal TCP peer for a session, independent of any client address that a PROXY protocol header asserts. For details, see mongo Schema Audit Messages and OCSF Schema Audit Messages.

Starting in MongoDB 9.0, the following metrics are available when using the replSetGetStatus command during a logical initial sync:

Each document in initialSyncAttempts also reports the phase, nodeUptimeSecs, and phaseDurations for that attempt. For details, see replSetGetStatus.initialSyncStatus.initialSyncAttempts.

Starting in MongoDB 9.0, key-extraction failures on 2dsphere indexes produce structured diagnostics that make unindexable documents easier to identify:

  • Geo key-extraction failures now throw the named error codes 510 (GeoKeyExtractionFailed) and 511 (GeoKeyExtractionFailedTimeseries), which replace the previous unnamed assertion codes.

  • Failed geo inserts and index builds now include a writeErrors[].errInfo document that contains the failingPath, underlyingCode, underlyingReason, and failingElement fields. Existing field names are unchanged, but the error reason string is now bounded to 256 characters.

  • The validate.errors output for geo key-extraction failures now emits a bounded, self-contained message and writes full per-document detail to the mongod log. Identical failures on the same index and path are deduplicated into a single message, so to map a failure back to specific documents, consult the log instead of the validate output. Full per-document detail is logged only when log redaction is disabled. For details, see validate.

Starting in MongoDB 9.0, serverStatus reports the following change stream cursor metrics on each mongod and mongos process:

The currentOp command and the $currentOp stage also report currentOp.cursor.changeStreams.optime, the change stream cursor's current position in the oplog. To learn more about change streams, see MongoDB Change Streams.

This section describes known issues in MongoDB 9.0 and their resolution status.

In Version
Issue
Status

9.0.0, 9.0.1, 9.02

SERVER-133518: A shard can hang during step-up when a chunk operation that was interrupted during a prior step-down blocks recovery of a persisted migration recipient. If the hang occurs, the shard cannot become primary, and writes and reads using primary read preference become unavailable on the shard. Secondaries can continue serving reads. To recover, restart or force-terminate the hung node so another secondary can become a writable primary.

Fixed in MongoDB 9.0.3.