Before you attempt any downgrade, familiarize yourself with the content of this document.
Downgrade Path
Once upgraded to 3.6, if you need to downgrade, we recommend downgrading to the latest patch release of 3.4.
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 3.6 features
incompatible with 3.4
versions as outlined below. These steps are necessary only if
featureCompatibilityVersion has ever been set to "3.6".
1. Downgrade Feature Compatibility Version
Downgrade the
featureCompatibilityVersionto"3.4".db.adminCommand({setFeatureCompatibilityVersion: "3.4"}) The
setFeatureCompatibilityVersioncommand performs writes to an internal system collection and is idempotent. If for any reason the command does not complete successfully, retry the command on themongodinstance.
2. Remove Backwards Incompatible Persisted Features
Remove all persisted features that are incompatible with 3.4. For example, if you have defined
any any view definitions, document validators, and partial index
filters that use 3.6 query features such as $jsonSchema or
$expr, you must remove them.
Procedure
Download the latest 3.4 binaries.
Using either a package manager or a manual download, get the latest release in the 3.4 series. If using a package manager, add a new repository for the 3.4 binaries, then perform the actual downgrade process.
Once upgraded to 3.6, if you need to downgrade, we recommend downgrading to the latest patch release of 3.4.
Restart with the latest 3.4 mongod instance.
Shut down your mongod instance. Replace the existing
binary with the downloaded mongod binary and restart.
Perform a clean shut down of the
mongodprocess.Note
If you do not perform a clean shut down, errors may result that prevent the
mongodprocess from starting.Forcibly terminating the
mongodprocess may cause inaccurate results fordb.collection.count()anddb.stats()as well as lengthen startup time the next time that themongodprocess is restarted.This applies whether you attempt to terminate the
mongodprocess from the command line viakillor similar, or whether you use your platform's initialization system to issue astopcommand, likesudo systemctl stop mongodorsudo service mongod stop.Replace the 3.6 binary with the 3.4 binary.
Start the 3.4
mongodprocess.