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

Compatibility Changes in MongoDB 9.1

Warning

MongoDB 9.1 Not Yet Available

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

MongoDB 9.1 introduces changes that can affect compatibility with older versions of MongoDB.

Starting in MongoDB 9.1, an invalid compound wildcard index blocks the FCV upgrade to 9.1. An index is invalid if its wildcardProjection does not meet the validation rules. Earlier versions of MongoDB allowed you to create these indexes, and queries that use them can cause undefined behavior.

If your deployment contains an invalid index, the setFeatureCompatibilityVersion command fails with a CannotUpgrade error before the upgrade begins. The FCV remains unchanged. The error message identifies the collection, the index, and the validation rule that the index does not meet.

To upgrade a deployment that contains invalid compound wildcard indexes, follow these steps:

1

Run the setFeatureCompatibilityVersion command with dryRun: true. The dry run checks for invalid indexes without changing the FCV. If the dry run finds an invalid index, it returns a CannotUpgrade error that identifies the first invalid index that it finds.

db.adminCommand( {
setFeatureCompatibilityVersion: "9.1",
dryRun: true
} )
2

Use the db.collection.dropIndex() method to drop the index that the error identifies. If you still need the index, create a replacement index that meets the validation rules.

3

The dry run reports only one invalid index each time it runs. Repeat the previous steps until the dry run succeeds.

4

Run the setFeatureCompatibilityVersion command with confirm: true:

db.adminCommand( {
setFeatureCompatibilityVersion: "9.1",
confirm: true
} )
Rate this page

On this page