This version of the documentation is archived and no longer supported.

Upgrade a Standalone to 4.2

The following steps outline the procedure to upgrade a standalone mongod from version 4.0 to 4.2.


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

If you need guidance on upgrading to 4.2, MongoDB offers major version upgrade services to help ensure a smooth transition without interruption to your MongoDB application.

Upgrade Recommendations and Checklists

When upgrading, consider the following:

Upgrade Version Path

To upgrade an existing MongoDB deployment to 4.2, you must be running a 4.0-series release.

To upgrade from a version earlier than the 4.0-series, you must successively upgrade major releases until you have upgraded to 4.0-series. For example, if you are running a 3.6-series, you must upgrade first to 4.0 before you can upgrade to 4.2.

Check Driver Compatibility

Before you upgrade MongoDB, check that you’re using a MongoDB 4.2-compatible driver. Consult the driver documentation for your specific driver to verify compatibility with MongoDB 4.2.

Upgraded deployments that run on incompatible drivers might encounter unexpected or undefined behavior.


Before beginning your upgrade, see the Compatibility Changes in MongoDB 4.2 document to ensure that your applications and deployments are compatible with MongoDB 4.2. 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

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


MMAPv1 to WiredTiger Storage Engine

MongoDB 4.2 removes support for the deprecated MMAPv1 storage engine.

If your 4.0 deployment uses MMAPv1, you must change the 4.0 deployment to WiredTiger Storage Engine before upgrading to MongoDB 4.2. For details, see Change Standalone to WiredTiger.

Increase Open Files ulimit Setting

Starting in MongoDB 4.2, incoming connections to a mongod or mongos instance require two file descriptors. In previous versions of MongoDB, incoming connections required one file descriptor.

Prior to upgrading from MongoDB 4.0 to 4.2, you may need to increase the value of your open files ulimit setting (-n).

Review Current Configuration

With MongoDB 4.2, the mongod and mongos processes will not start with MMAPv1 Specific Configuration Options. Previous versions of MongoDB running WiredTiger ignored MMAPv1 configurations options if they were specified. With MongoDB 4.2, you must remove these from your configuration.

Feature Compatibility Version

The 4.0 instance must have featureCompatibilityVersion set to 4.0. To check featureCompatibilityVersion:

db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )

The operation should return a result that includes "featureCompatibilityVersion" : { "version" : "4.0" }.

To set or update featureCompatibilityVersion, run the following command:

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

For more information, see setFeatureCompatibilityVersion.

Download 4.2 Binaries

Via Package Manager

If you installed MongoDB from the MongoDB apt, yum, dnf, or zypper repositories, you should upgrade to 4.2 using your package manager.

Follow the appropriate 4.2 installation instructions for your Linux system. This will involve adding a repository for the new release, then performing the actual upgrade process.


If you have not installed MongoDB using a package manager, you can manually download the MongoDB binaries from the MongoDB Download Center.

See 4.2 installation instructions for more information.

Upgrade Process


Replace existing 4.0 binaries with the 4.2 binaries.

Shut down your mongod instance. Replace the existing binary with the 4.2 mongod binary.

Restart your deployment with the 4.2 mongod.


Enable backwards-incompatible 4.2 features.

At this point, you can run the 4.2 binaries without the 4.2 features that are incompatible with 4.0.

To enable these 4.2 features, set the feature compatibility version (FCV) to 4.2.


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.2" } )

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.

Post Upgrade

TLS Options Replace Deprecated SSL Options

Starting in MongoDB 4.2, MongoDB deprecates the SSL options for the mongod, the mongos, and the mongo shell as well as the corresponding net.ssl Options configuration file options.

To avoid deprecation messages, use the new TLS options for the mongod, the mongos, and the mongo shell.

4.2+ compatible Drivers Retry Writes by Default

MongoDB 3.6 introduced support for Retryable Writes, but most official MongoDB 3.6 and 4.0-compatible drivers disabled this feature by default. For such drivers, retryable writes could be enabled per connection by including the retryWrites=true option in the connection string for that connection. Refer to the MongoDB Driver Documentation to determine the correct default state of retryWrites for your specific driver and version.

The official MongoDB 4.2+ compatible drivers enable Retryable Writes by default. Applications upgrading to the 4.2+ compatible drivers that require retryable writes may omit the retryWrites=true option. Applications upgrading to the 4.2+ compatible drivers that require disabling retryable writes must include retryWrites=false in the connection string.

Additional Upgrade Procedures