Docs Menu

Downgrade 4.4 Standalone to 4.2

On this page

  • Downgrade Path
  • Create Backup
  • Access Control
  • Prerequisites
  • Procedure

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

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

Downgrade Floor

If you need to downgrade from version 4.4, downgrade to 4.2.6 or a later version. You cannot downgrade to 4.2.5 or an earlier version.

Optional but Recommended. Create a backup of your database.

If your deployment 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.

To downgrade from 4.4 to 4.2, you must remove incompatible features that are persisted and/or update incompatible configuration settings. These include:

Starting in MongoDB 4.4:

  • For featureCompatibilityVersion set to "4.4" or greater, MongoDB raises the limit on collection/view namespace to 255 bytes. For a collection or a view, the namespace includes the database name, the dot (.) separator, and the collection/view name (e.g. <database>.<collection>),
  • For featureCompatibilityVersion set to "4.2" or earlier, the maximum length of the collection/view namespace remains 120 bytes.

Before downgrading, resolve any collections or views with namespaces that exceed the 120-byte Namespace Length limit for Feature Compatibility Version (fCV) 4.2.

To determine if you have any collections or views with namespaces that exceed the 120-byte limit, connect mongo shell to the mongod instance and run:

let mdb = db.getSiblingDB(;
mdb.getCollectionInfos( ).forEach(function(c){
namespace = + "." +
namespacelenBytes = encodeURIComponent(namespace).length
if (namespacelenBytes > 120) {
print (c.type.toUpperCase() + " namespace exceeds 120 bytes:: " + namespace )
} )

If any collection or view namespace exceeds 120 bytes, then prior to downgrading the fCV:

  • Rename the collection using the renameCollection command.
  • For views, use db.createView() to recreate the view using a shorter name, then drop the original view.

To downgrade the featureCompatibilityVersion of your standalone:

  1. Connect a mongo shell to the mongod instance.
  2. Downgrade the featureCompatibilityVersion to "4.2".
    db.adminCommand({setFeatureCompatibilityVersion: "4.2"})
    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.

The following steps are necessary only if fCV has ever been set to "4.4".

Remove all persisted 4.4 features that are incompatible with 4.2. These include:

Compound Hashed Indexes

Remove all compound hashed indexes.

Use db.collection.getIndexes() to identify any compound hashed indexes in a collection and use db.collection.dropIndex() to remove those indexes.

Remove all persisted features that use 4.4 features. These include but are not limited to:


Before proceeding with the downgrade procedure, ensure that the prerequisites have been completed.


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

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


To cleanly shut down the mongod process, connect a mongo shell to the instance and run:

db.adminCommand( { shutdown: 1 } )

A clean shutdown of a mongod completes all pending operations, flushes all data to data files, and closes all data files.


Replace the 4.4 binary with the downloaded 4.2 mongod binary and restart.

Give Feedback
© 2021 MongoDB, Inc.


  • Careers
  • Legal Notices
  • Privacy Notices
  • Security Information
  • Trust Center
© 2021 MongoDB, Inc.