ApsaraDB for MongoDB supports MongoDB 3.4, 4.0, and 4.2, as well as the WiredTiger storage engine. You can choose a storage engine and a MongoDB version that best suits your business needs when you create an instance.

MongoDB versions and advantages

Compared with MongoDB 3.2, MongoDB 3.4 provides higher performance and security. MongoDB 4.0 is more suitable for finance and scenarios that are dependent on transactions and use NoSQL features. MongoDB 4.2 uses the two-stage commit method to ensure the atomicity, consistency, isolation, durability (ACID) feature of sharded cluster transactions. This greatly expands its business scenarios. The following table describes the advantages of MongoDB versions.
Note MongoDB 3.2 has been phased out. For more information, see Notice: ApsaraDB for MongoDB has phased MongoDB 3.2 out and released MongoDB 4.2 since February 4.
MongoDB version Advantage
MongoDB 3.4
  • Faster primary-secondary synchronization

    All indexes are created when data is synchronized (only the _id index is created in earlier versions). During data synchronization, the secondary node continuously reads new oplog information to ensure that the local database of the secondary node has enough space to store temporary data.

  • More efficient load balancing

    In earlier versions, Mongos nodes are responsible for load balancing of sharded cluster instances. Multiple Mongos nodes contest a distributed lock. The node that obtains the lock performs load balancing tasks and migrates chunks between shard nodes. In MongoDB 3.4, the primary Configserver node is responsible for load balancing. This greatly improves the concurrency and efficiency of load balancing.

  • More aggregation operations

    Many aggregation operators are added in MongoDB 3.4 to provide more powerful data analysis capabilities. For example, bucket can conveniently classify data. $grahpLookup supports more complex relational operations than $lookup in MongoDB 3.2. $addFields enables richer document operations such as summing some fields and saving them as a new field.

  • Sharding zones supported

    The zone concept is introduced for sharded cluster instances to replace the current tag-aware sharding mechanism. It can allocate data to one or more specified shard nodes. This feature allows you to conveniently deploy sharded cluster instances across data centers.

  • Collation supported

    In earlier versions, strings stored in documents are always compared byte by byte regardless of Chinese, English, uppercase, or lowercase. After collation is introduced, the string content can be interpreted or compared based on the used locale. Case-insensitive comparison is also supported.

  • Read-only views

    MongoDB 3.4 supports read-only views. It virtualizes the data that meets a certain query condition into a special collection, on which you can perform further queries.

MongoDB 4.0
  • Cross-document transactions

    As the first NoSQL database that supports cross-document transactions, MongoDB 4.0 combines the speed, flexibility, features, and ACID guarantee of document models.

  • Migration speed increase by 40%

    Concurrent read and write operations enable new shard nodes to migrate data fast and bear service load.

  • Read performance significantly improved

    With the transaction feature, secondary nodes no longer block read requests due to log synchronization. The multi-node scaling feature is supported in all versions to significantly improve reading capabilities.

Note You can manually upgrade the MongoDB version while an instance is running. However, you cannot downgrade the MongoDB version. For more information, see Upgrade MongoDB versions.

Storage engines

Storage engine Description Scenario
WiredTiger Data is in the B-tree structure. Compared with the earlier MMAPv1 storage engine, WiredTiger provides significantly improved performance and reduces storage costs through data compression. It is the default storage engine and applicable to most business scenarios.

Relationship between MongoDB versions and storage engines

The following tables describe the relationship between MongoDB versions and storage engines.

Storage engine MongoDB 3.4 MongoDB 4.0 MongoDB 4.2

Standalone instance (pay-as-you-go)

Replica set instance

Sharded cluster instance

Standalone instance (pay-as-you-go)

Replica set instance

Sharded cluster instance

Replica set instance

Sharded cluster instance