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.
Indexes
Invalid Compound Wildcard Indexes Block FCV Upgrade
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:
Check for an invalid index.
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 } )
Drop the invalid index.
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.
Upgrade the FCV.
Run the setFeatureCompatibilityVersion command with confirm: true:
db.adminCommand( { setFeatureCompatibilityVersion: "9.1", confirm: true } )