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 | ![]() |
![]() |
![]() |
![]() |
![]() |
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 | ![]() |
![]() |
![]() |
![]() |
![]() |
||
Sharded cluster instance | ![]() |
![]() |
![]() |
![]() |
![]() |
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
- The duration of upgrading the MongoDB version of an instance is related to the data volume of databases in this instance. We recommend that you schedule your upgrade task during off-peak hours.
- You cannot downgrade the MongoDB version of an instance after you upgrade it.
- If the minor version of an instance expires or is not included in the maintenance list, ApsaraDB for MongoDB automatically updates the minor version of the instance to the latest version when you perform the following operations. This ensures the performance and stability of the instance.
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.