Docs Home → Develop Applications → MongoDB Manual
Upgrade a Standalone to 4.0![](/docs/v5.3/assets/link.svg)
On this page
Important
MongoDB 4.0 may lose data during unclean shutdowns on macOS 10.12.x, 10.13.x, and 10.14.0. This issue was fixed by Apple in macOS 10.14.1.
For details, see WT-4018.
The following steps outline the procedure to upgrade a standalone
mongod
from version 3.6 to 4.0.
Important
Before you attempt any upgrade, please familiarize yourself with the content of this document.
If you need guidance on upgrading to 4.0, MongoDB offers major version upgrade services to help ensure a smooth transition without interruption to your MongoDB application.
Upgrade Recommendations and Checklists![](/docs/v5.3/assets/link.svg)
When upgrading, consider the following:
Upgrade Version Path![](/docs/v5.3/assets/link.svg)
To upgrade an existing MongoDB deployment to 4.0, you must be running a 3.6-series release.
To upgrade from a version earlier than the 3.6-series, you must successively upgrade major releases until you have upgraded to 3.6-series. For example, if you are running a 3.4-series, you must upgrade first to 3.6 before you can upgrade to 4.0.
Check Driver Compatibility![](/docs/v5.3/assets/link.svg)
Before you upgrade MongoDB, check that you're using a MongoDB 4.0-compatible driver. Consult the driver documentation for your specific driver to verify compatibility with MongoDB 4.0.
Upgraded deployments that run on incompatible drivers might encounter unexpected or undefined behavior.
Preparedness![](/docs/v5.3/assets/link.svg)
Before beginning your upgrade, see the Compatibility Changes in MongoDB 4.0 document to ensure that your applications and deployments are compatible with MongoDB 4.0. Resolve the incompatibilities in your deployment before starting the upgrade.
Before upgrading MongoDB, always test your application in a staging environment before deploying the upgrade to your production environment.
Downgrade Consideration![](/docs/v5.3/assets/link.svg)
Once upgraded to 4.0, if you need to downgrade, we recommend downgrading to the latest patch release of 3.6.
Prerequisites![](/docs/v5.3/assets/link.svg)
Remove Support for MONGODB-CR
![](/docs/v5.3/assets/link.svg)
Starting in version 4.0, MongoDB removes support for the deprecated
MongoDB Challenge-Response (MONGODB-CR
) authentication mechanism.
If your deployment has user credentials stored in MONGODB-CR
schema, you must upgrade to Salted Challenge Response
Authentication Mechanism (SCRAM) before you
upgrade to version 4.0. For information on upgrading to SCRAM
, see
Upgrade to SCRAM.
Tip
See also:
Remove Support for $isolated
![](/docs/v5.3/assets/link.svg)
MongoDB drops support for the $isolated
operator. If you have an
existing partial index that includes the $isolated
operator or a
view that includes a $isolated
operator, recreate the index or
view without the operator in the definition before upgrading.
Feature Compatibility Version![](/docs/v5.3/assets/link.svg)
The 3.6 instance must have featureCompatibilityVersion
set
to 3.6
. To check featureCompatibilityVersion
:
db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )
The operation should return a result that includes
"featureCompatibilityVersion" : { "version" : "3.6" }
.
To set or update featureCompatibilityVersion
, run the following
command:
db.adminCommand( { setFeatureCompatibilityVersion: "3.6" } )
For more information, see setFeatureCompatibilityVersion
.
Download 4.0 Binaries![](/docs/v5.3/assets/link.svg)
Via Package Manager![](/docs/v5.3/assets/link.svg)
If you installed MongoDB from the MongoDB apt
, yum
, dnf
, or
zypper
repositories, you should upgrade to 4.0 using your package
manager.
Follow the appropriate 4.0 installation instructions for your Linux system. This will involve adding a repository for the new release, then performing the actual upgrade process.
Manually![](/docs/v5.3/assets/link.svg)
If you have not installed MongoDB using a package manager, you can manually download the MongoDB binaries from the MongoDB Download Center.
See 4.0 installation instructions for more information.
Upgrade Process![](/docs/v5.3/assets/link.svg)
Enable backwards-incompatible 4.0 features.![](/docs/v5.3/assets/link.svg)
At this point, you can run the 4.0 binaries without the 4.0 features that are incompatible with 3.6.
To enable these 4.0 features, set the feature compatibility
version (FCV
) to 4.0.
Tip
Enabling these backwards-incompatible features can complicate the downgrade process since you must remove any persisted backwards-incompatible features before you downgrade.
It is recommended that after upgrading, you allow your deployment to run without enabling these features for a burn-in period to ensure the likelihood of downgrade is minimal. When you are confident that the likelihood of downgrade is minimal, enable these features.
Run the setFeatureCompatibilityVersion
command against the admin
database:
db.adminCommand( { setFeatureCompatibilityVersion: "4.0" } )
This command must perform writes to an internal system collection. If for any reason the command does not complete successfully, you can safely retry the command as the operation is idempotent.
Additional Upgrade Procedures![](/docs/v5.3/assets/link.svg)
To upgrade a replica set, see Upgrade a Replica Set to 4.0.
To upgrade a sharded cluster, see Upgrade a Sharded Cluster to 4.0.