Docs Menu
Docs Home
/ /

Compatibility Changes in MongoDB 9.0

Warning

MongoDB 9.0 Not Yet Available

MongoDB 9.0 release candidates are not yet available. This version of the manual is for an upcoming release and is currently a work in progress.

This page describes changes introduced in MongoDB 9.0 that can affect compatibility with older versions of MongoDB.

Starting in MongoDB 9.0, the $group stage returns an error if an accumulator expression has an empty field name. For details, see Empty Field Name $group Restriction.

Starting in MongoDB 9.0, the $queryStats key for aggregate commands includes the allowPartialResults option when the option is explicitly set. Query stats can then distinguish between requests where allowPartialResults is omitted, explicitly true, or explicitly false.

The addition changes the key and keyHash serialization for aggregate queries that set allowPartialResults. The queryShapeHash is unchanged. Downstream consumers that match on keyHash might observe different values for these queries.

For more information, see the aggregate command query shape.

Starting in MongoDB 9.0, if an indexed field becomes a multikey field while a query that references the field is running, the query might fail with a QueryKilledError. An indexed field becomes multikey when you insert or update a document so the field contains an array value.

If your query fails with this error, re-run the query after the insert or update operation completes.

Starting in MongoDB 9.0, when you rename a collection between different databases on a replica set, the renameCollection command holds an exclusive lock on the source and target collections. The lock lasts for the entire operation, and blocks DDL operations and writes to both collections. Most read operations use lock-free reads and are not blocked.

Earlier versions released the source collection's lock before renameCollection completed the rename. A concurrent write to the source collection during that window could be lost.

The change affects replica sets only. Sharded clusters already lock both collections for the duration of the rename.

Back

9.0 (Upcoming)

On this page