MongoDB Best Practices

Chapter 1 · Practice 3 of 3

Read the release notes and known issues before a major upgrade

From Versions and deployment

Why it matters

Major upgrades change defaults and occasionally ship with known issues. The 9.0 release notes, for example, list:

  • A per-operation memory limit (see the queries chapter) that can make heavy aggregations fail where they used to succeed.
  • BSON validation on by default: invalid BSON is now rejected.
  • A known issue where listIndexes reports a simple collation explicitly at feature compatibility version 9.0, which can make Mongoose's syncIndexes() drop and rebuild unchanged indexes on every startup. The notes say to upgrade to Mongoose 9.10.4 or 8.24.5, or stop calling syncIndexes() at startup.
  • A sharded cluster issue fixed in a later patch.

Upgrade in steps: one major version at a time, keep the old feature compatibility version (FCV) for a while so you can roll back, then raise FCV once the app is stable.

Example

JavaScript
// After upgrading binaries and verifying the app
db.adminCommand({ getParameter: 1, featureCompatibilityVersion: 1 })
db.adminCommand({ setFeatureCompatibilityVersion: "9.0", confirm: true })