When new MongoDB versions are supported by ApsaraDB for MongoDB, you can upgrade your instance to the latest MongoDB version in the ApsaraDB for MongoDB console to try more features. This topic describes the MongoDB versions to which instances can be upgraded and how to upgrade the MongoDB version of an instance.

MongoDB versions

For more information about the MongoDB versions supported by ApsaraDB for MongoDB, see MongoDB versions and storage engines.

Supported major versions

The following table lists the major versions of MongoDB and describes whether the versions are supported in different ApsaraDB for MongoDB instance architectures.
Instance architecture MongoDB 5.0 MongoDB 4.4 MongoDB 4.2 MongoDB 4.0 MongoDB 3.4 MongoDB 3.2 MongoDB 3.0
Standalone instance 1 1 1 2 2 This major version is phased out. For more information, see Notice: ApsaraDB for MongoDB has phased MongoDB 3.2 out and released MongoDB 4.2 since February 4. This major version is phased out.
Replica set instance 2 2 2 2 2
Sharded cluster instance 2 2 2 2 2

Major versions to which you can upgrade

The following table describes MongoDB major versions and their matched ApsaraDB for MongoDB instance architectures.
Instance architecture Major version before upgrade Major version to which you can upgrade
Standalone instance MongoDB 3.4 and MongoDB 4.0 N/A
Replica set instance MongoDB 5.0 N/A
MongoDB 4.4 MongoDB 5.0
MongoDB 4.2 N/A
MongoDB 4.0 MongoDB 4.2
MongoDB 3.4 MongoDB 4.0 and MongoDB 4.2
Sharded cluster instance MongoDB 5.0 N/A
MongoDB 4.4 MongoDB 5.0
MongoDB 4.2 N/A
MongoDB 4.0 MongoDB 4.2
MongoDB 3.4 MongoDB 4.0 and MongoDB 4.2

Precautions

Impacts

  • Nodes in an instance are upgraded in turn. An instance is automatically restarted two or three times during an upgrade. We recommend that you perform the upgrade during off-peak hours or make sure that your application is configured to automatically re-establish a connection.
    Note If your application runs in a production environment, we recommend that you use a connection string URI to connect your application to the instance. This way, a primary/secondary switchover can be performed to ensure that the read and write operations of your application remain available even if a node fails. For more information, see Connect to a replica set instance or Connect to a sharded cluster instance.
  • The balancer of a sharded cluster instance is disabled during an upgrade and is enabled after the upgrade.

Procedure

  1. Log on to the ApsaraDB for MongoDB console.
  2. In the left-side navigation pane, click Replica Set Instances or Sharded Cluster Instances based on the instance type.
  3. In the upper-left corner of the page, select the resource group and region to which the instance belongs.
  4. Click the ID of an instance, or click More icon in the Actions column corresponding to the instance and select Manage.
  5. Click Upgrade Database Version in the upper-right corner of the Specifications Information section and select the MongoDB version to which you want to upgrade the instance.
  6. In the Upgrade Database Version message, click OK.