Important
MongoDB 8.3 Release Candidates
MongoDB 8.3 binaries are currently available only as release candidates. Release candidates can be used for early testing of new features, but are not suitable for production deployments.
This version of the manual is for an upcoming release and is currently a work in progress.
Before you attempt a downgrade, familiarize yourself with the content in this page.
Downgrade Path
Important
Before you upgrade or downgrade a replica set, ensure all replica set members are running. If you do not, the upgrade or downgrade will not complete until all members are started.
For any versions, major or minor, you can upgrade or downgrade to its adjacent neighbors. For example, you can downgrade from 8.3 to 8.2 or upgrade from 7.0 to 8.0.
For all versions, major or minor, you can downgrade to the immediately previous major version. For example, from 8.3 to 8.0.
For any minor version, you can upgrade to the immediately next version. For example, from 8.2 to 8.3.
If you need to downgrade from 8.3, downgrade to the latest patch release of 8.2.
MongoDB supports single-version downgrades along adjacent versions only. You cannot downgrade to a release that is multiple versions behind your current release.
For any versions, major or minor, you can upgrade or downgrade to its adjacent neighbors. For example, you can downgrade from 8.3 to 8.2 or upgrade from 7.0 to 8.0.
For all versions, major or minor, you can downgrade to the immediately previous major version. For example, from 8.3 to 8.0.
For any minor version, you can upgrade to the immediately next version. For example, from 8.2 to 8.3.
Access Control
If your replica set has access control enabled, your downgrade user
privileges must include privileges to list and manage indexes across
databases. A user with root role has the required
privileges.
Prerequisites
Before you begin the downgrade procedure, you must complete the following prerequisite steps.
Create Backup
Optional but recommended. Create a backup of your database.
To learn how to create a backup, see Backup Methods for a Self-Managed Deployment.
Remove Backward-Incompatible Features
To downgrade from 8.3 to 8.2, you must remove 8.3 features that are incompatible with 8.2. For a list of incompatible features and how to remove them, see Downgrade Considerations.
Downgrade Feature Compatibility Version (FCV)
To downgrade the FCV of your replica set:
Ensure that no initial sync is in progress. Running the
setFeatureCompatibilityVersioncommand while an initial sync is in progress causes the initial sync to restart.Ensure that no nodes have a
newlyAddedfield in their replica set configuration. Run the following command on each node in your replica set to verify this:use local db.system.replset.find( { "members.newlyAdded" : { $exists : true } } ); The
newlyAddedfield only appears in a node's replica set configuration document during and shortly after an initial sync.Ensure that no replica set member is in the
ROLLBACKorRECOVERINGstate.Use
mongoshto connect to your primary.Downgrade the
featureCompatibilityVersionto"8.2".Important
After you modify the
featureCompatibilityVersionand enable new features, you cannot downgrade the binary version without assistance from support. Make sure to evaluate your upgrade path before proceeding.db.adminCommand( { setFeatureCompatibilityVersion: "8.2", confirm: true } ) The
setFeatureCompatibilityVersioncommand performs writes to an internal system collection and is idempotent. If the command does not complete successfully, retry the command on the primary.To ensure that all members of the replica set have the updated
featureCompatibilityVersion, connect to each replica set member and check thefeatureCompatibilityVersion:db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } ) "featureCompatibilityVersion" : { "version" : "8.2" } If any member returns a
featureCompatibilityVersionof"8.3", wait for the member to return version"8.2"before proceeding.
For more information on the returned featureCompatibilityVersion
value, see Get FeatureCompatibilityVersion.
Downgrade Procedure
Warning
Before proceeding with the downgrade procedure, ensure that all
replica set members, including delayed replica set members, have the
prerequisite changes. To do that, check the
featureCompatibilityVersion and the remove the incompatible
features for each node before downgrading.
Download the latest 8.2 binaries
Using either a package manager or a manual download, get the latest release of 8.2. If using a package manager, add a new repository for the 8.2 binaries, then perform the actual downgrade process.
Important
Before you upgrade or downgrade a cluster, ensure all cluster members are running. If you do not, the upgrade or downgrade will not complete until all members are started.
For any versions, major or minor, you can upgrade or downgrade to its adjacent neighbors. For example, you can downgrade from 8.3 to 8.2 or upgrade from 7.0 to 8.0.
For all versions, major or minor, you can downgrade to the immediately previous major version. For example, from 8.3 to 8.0.
For any minor version, you can upgrade to the immediately next version. For example, from 8.2 to 8.3.
If you need to downgrade from 8.3, downgrade to the latest patch release of 8.2.
Downgrade secondary members of the replica set
Downgrade each secondary member of the replica set, one at a time:
Shut down the member.
To shut down the
mongodprocess, usemongoshto connect to the secondary and run the following command:db.adminCommand( { shutdown: 1 } ) Restart the member.
To start a
mongodprocess, run the following command:mongod --dbpath </path-to-data-folder> To learn more about starting a
mongodprocess, see StartmongodProcesses.Wait for the member to enter the
SECONDARYstate.Before downgrading the next secondary, wait for the member to recover to the
SECONDARYstate. To check the member's state, use thers.status()method inmongosh.After the member is in
SECONDARYstage, downgrade the next secondary.
Downgrade the arbiter replica set member, if any
Skip this step if the replica set does not include an arbiter.
Downgrade the arbiter member of the replica set:
Shut down the member.
To shutdown the arbiter, use
mongoshto connect to the arbiter and run the following command:db.adminCommand( { shutdown: 1 } ) Delete the contents of the arbiter data directory.
To find the data directory of the arbiter
mongod, check either thestorage.dbPathconfiguration setting or--dbpathcommand line option.Run the following command:
rm -rf /path/to/mongodb/datafiles/* Restart the arbiter.
To start a
mongodprocess, run the following command:mongod --dbpath </path-to-mongodb-datafiles> To learn more about starting a
mongodprocess, see StartmongodProcesses.Wait for the member to enter the
ARBITERstate.Before downgrading the primary, wait for the member to recover to the
ARBITERstate. To check the member's state, use thers.status()method inmongosh.
Downgrade the primary
Step down the primary.
In
mongosh, users.stepDown()to step down the primary and force the normal failover procedure.rs.stepDown() Verify that the primary has stepped down.
Run the following command:
rs.status() Verify that the primary has stepped down and another member has assumed the
PRIMARYstate.Replace and restart the former primary
mongod.Shut down the member.
To perform a shutdown of the primary, use
mongoshto connect to the primary and run the following command:db.adminCommand( { shutdown: 1 } ) Restart
mongodwith the 8.2 binary.To start a
mongodprocess, run the following command:mongod --dbpath </path-to-mongodb-datafiles> To learn more about starting a
mongodprocess, see StartmongodProcesses.