You can migrate data from a self-managed MongoDB database to an ApsaraDB for MongoDB instance, but you must pay close attention to the limits of ApsaraDB for MongoDB.

Standalone instances

Operation Limit
Deploy an instance
  • Standalone instances support only the single-zone deployment method and can be created only in the following regions: China (Hangzhou), China (Shanghai), China (Shenzhen), China (Qingdao), China (Beijing), and Singapore (Singapore).
    Note
    • For example, Hangzhou Zone F supports the single-zone deployment method, and Hangzhou Zones (B + E + F) supports the multi-zone deployment method.
    • In the China (Beijing) region, standalone instances can be created only in Zone A, Zone B, Zone C, Zone D, Zone E, Zone F, Zone G, and Zone H.
  • The instance cannot be migrated to another zone.
Configure the database version Standalone instances are supported only for MongoDB 4.0 and MongoDB 3.4.
Configure the storage engine

The storage engine must be WiredTiger.

Log management Log management features including slow query logs, error logs, and operational logs are not supported.
Data security
Migrate and synchronize data
Back up data Only the snapshot backup method is supported.
Note A snapshot is a point-in-time backup of disk data.
Restore data
CloudDBA
  • Only performance trend, real-time performance, and instance sessions are supported.
  • Storage analysis and slow query logs are not supported.

Replica set instances

Operation Limit
Deploy an instance The database version must match the storage engine. For more information, see MongoDB versions and storage engines.
Build replica set nodes
  • A replica set instance automatically created by ApsaraDB for MongoDB consists of a primary node, a hidden secondary node that is invisible to you, and one or more secondary nodes.
  • When a replica set instance is running, you can scale the instance to one that has three, five, or seven nodes. For more information, see A new version is available..
    Note You cannot connect to a replica set instance from a secondary node of a self-managed database. If you want to synchronize data from a replica set instance to a self-managed MongoDB database for data testing or analysis, you can use MongoShake. For more information, see Use MongoShake to implement one-way synchronization between ApsaraDB for MongoDB replica set instances.
Upgrade the minor version To ensure better performance and stability of the instance, the system will upgrade the minor version to the latest version by default. If the minor version of your instance expires or is not included in the maintenance list and the instance is upgraded, migrated, changed, Created from a backup, Created by point-in-time, or performed Restore data to a new ApsaraDB for MongoDB instance.
Restart an instance You must restart an instance by using the ApsaraDB for MongoDB console or by calling the RestartDBInstance operation.
Migrate data You can use the built-in commands of MongoDB or Data Transmission Service (DTS) to migrate data. For more information, see Migrate the replica set of a self-managed MongoDB database to Alibaba Cloud by using DTS or Migrate self-managed databases to Alibaba Cloud by using tools provided by MongoDB.
Back up data Automatic backup supports only physical backup. Manual backup supports both physical and logical backup. For more information, see Configure automatic backup for an ApsaraDB for MongoDB instance and Manually back up an ApsaraDB for MongoDB instance.
Note If the database version of an instance is 3.2 or 3.4, the number of collections and indexes in the instance cannot exceed 10,000. Otherwise, physical backup may fail. If you want to increase this limit, we recommend that you upgrade the database version to 4.0 or 4.2. For more information, see Upgrade MongoDB versions. Alternatively, you can set the database version to 4.0 or 4.2 when you create an instance.
Restore data
Modify parameters For security and stability reasons, some parameters cannot be modified. For more information, see Configure database parameters for an ApsaraDB for MongoDB instance.

Sharded cluster instances

Operation Limit
Deploy an instance The database version must match the storage engine. For more information, see MongoDB versions and storage engines.
Build nodes
  • When you create a sharded cluster instance, you can specify the specifications and numbers of mongos and shards.
  • When the instance is running, you can add mongos and shards, but you cannot remove them. For more information, see Configuration change overview.
Upgrade the minor version To ensure better performance and stability of the instance, the system will upgrade the minor version to the latest version by default. If the minor version of your instance expires or is not included in the maintenance list and the instance is upgraded, migrated, changed, Created from a backup, Created by point-in-time, or performed Restore data to a new ApsaraDB for MongoDB instance.
Restart an instance You must restart an instance by using the ApsaraDB for MongoDB console or by calling the RestartDBInstance operation.
Migrate data

To migrate data, you must use the built-in tools provided by MongoDB or Data Transmission Service (DTS). For more information, see Migrate a self-managed MongoDB database to ApsaraDB for MongoDB by using tools provided by MongoDB or Migrate the shards of a self-managed MongoDB database to Alibaba Cloud by using DTS.

Back up data Automatic backup supports only physical backup. Manual backup supports both physical and logical backup. For more information, see Configure automatic backup for an ApsaraDB for MongoDB instance and Manually back up an ApsaraDB for MongoDB instance.
Note If the database version of an instance is 3.2 or 3.4, the number of collections and indexes in the instance cannot exceed 10,000. Otherwise, physical backup may fail. If you want to increase this limit, we recommend that you upgrade the database version to 4.0. For more information, see Upgrade MongoDB versions.Alternatively, you can set the database version to 4.0 when you create an instance..
Restore data You can restore data only by point in time. For more information, see Restore data to a new ApsaraDB for MongoDB instance by point in time.
Modify parameters For security and stability reasons, some parameters cannot be modified.
Read and write data You can only read data from the admin database of a sharded cluster instance, and you cannot write data to the admin database.