You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit was created on GitHub.com and signed with GitHub’s verified signature.
Fixed
IndexMismatchRebuild no longer drops a non-unique index before recreating it as unique. On MongoDB 6.0+ (binary and featureCompatibilityVersion) the index is converted in place with collMod (prepareUnique: true, then unique: true), so there is no window where the collection is unindexed and a concurrent writer can insert a duplicate that would break the recreate and every subsequent Enforce. The read-only duplicate pre-check still runs first, so known duplicates never trigger a collMod. If a duplicate slips in between the pre-check and the conversion, prepareUnique is reverted and the existing index is left untouched. On any other failure of the final step the index is left in the prepared state (present, new duplicates rejected) and the next Enforce completes the conversion. Drop + recreate remains the fallback for servers that don't support prepareUnique and for mismatches collMod cannot fix (keys, sparse, partial, unique -> non-unique) (MSA-78).
Added
IndexSpec.PrepareUnique reports an index left in the collMod prepareUnique state; Enforce mismatch errors name that state explicitly, and IndexMismatchRebuild clears a stale one on a non-unique field in place.
IndexSpec.HasCollation, IndexSpec.HasTTL, IndexSpec.Hidden. Indexes with these options are never converted in place, so a rebuild still normalizes them to a plain unique index.
The duplicate pre-check now mirrors unique-index semantics for array (multikey) fields and no longer conflates dotted keys such as a.b with a_b.