Navigation

Downgrade 4.0 Standalone to 3.6

Before you attempt any downgrade, familiarize yourself with the content of this document.

Downgrade Path

Once upgraded to 4.0, if you need to downgrade, we recommend downgrading to the latest patch release of 3.6.

Create Backup

Optional but Recommended. Create a backup of your database.

Prerequisites

Before downgrading the binaries, you must downgrade the feature compatibility version and remove any 4.0 features incompatible with 3.6 versions as outlined below. These steps are necessary only if featureCompatibilityVersion has ever been set to "4.0".

1. Downgrade Feature Compatibility Version

  1. Connect a mongo shell to the mongod instance.

  2. Downgrade the featureCompatibilityVersion to "3.6".

    db.adminCommand({setFeatureCompatibilityVersion: "3.6"})
    

    The setFeatureCompatibilityVersion command performs writes to an internal system collection and is idempotent. If for any reason the command does not complete successfully, retry the command on the mongod instance.

2. Remove Backwards Incompatible Persisted Features

Remove all persisted features that are incompatible with 4.0. For example, if you have defined any view definitions, document validators, and partial index filters that use 4.0 query features such as the aggregation convert operators, you must remove them.

If you have users with only SCRAM-SHA-256 credentials, you should create SCRAM-SHA-1 credentials for these users before downgrading. To update a user who only has SCRAM-SHA-256 credentials, run db.updateUser() with mechanisms set to SCRAM-SHA-1 only and the pwd set to the password:

db.updateUser(
   "reportUser256",
   {
     mechanisms: [ "SCRAM-SHA-1" ],
     pwd: <newpwd>
   }
)

Procedure

Note

If you ran MongoDB 4.0 with authenticationMechanisms that included SCRAM-SHA-256, omit SCRAM-SHA-256 when restarting with the 3.6 binary.

1

Download the latest 3.6 binaries.

Using either a package manager or a manual download, get the latest release in the 3.6 series. If using a package manager, add a new repository for the 3.6 binaries, then perform the actual downgrade process.

Once upgraded to 4.0, if you need to downgrade, we recommend downgrading to the latest patch release of 3.6.

2

Restart with the latest 3.6 mongod instance.

Shut down your mongod instance. Replace the existing binary with the downloaded mongod binary and restart.