This topic compares self-managed MongoDB with the PolarDB for MySQL document database (compatible with the MongoDB protocol) across dimensions such as architecture and deployment, availability and reliability, and elasticity and scaling to help you choose the right solution.
Background and positioning
self-managed MongoDB refers to MongoDB databases that you install, configure, and maintain on your own servers or cloud instances. This approach gives you full control over database instances but also requires you to handle all O&M work, including installation, version upgrades, backup and recovery, high availability architecture setup, and monitoring and security systems. This places high demands on the technical capabilities of your O&M team.
The PolarDB for MySQL document database (compatible with the MongoDB protocol) capability is built on the MySQL 8.0.2 kernel and is provided as a fully managed document database service. You can use MongoDB protocol compatibility without managing the underlying infrastructure. Protocol conversion is performed at the database proxy layer and is decoupled from the kernel, so you can reuse enterprise-grade capabilities of PolarDB, such as connection pooling, load balancing, read/write splitting, high availability, elastic scaling, and backup and recovery. Compute nodes use a shared storage architecture with one primary node and multiple read-only nodes, and storage capacity scales automatically on demand. You can manage data through collections without creating tables or defining schemas, just as you would with MongoDB, while also using standard SQL to perform complex join queries and analysis on the same data.
Architecture and deployment
Dimension | self-managed MongoDB | PolarDB document database (compatible with the MongoDB protocol) |
Deployment and O&M | You must install MongoDB and configure replica sets or sharded clusters. O&M costs are high. | Fully managed service. You can create a cluster in the console with a single click. Initialization and configuration are completed automatically. |
Storage and compute | Storage and compute are bound to the same node. Scaling requires simultaneous expansion of both. | Compute-storage separation architecture. Compute nodes and storage capacity can be scaled independently and elastically. |
High availability | You must set up replica sets to achieve high availability. Failover depends on manual configuration or third-party tools. | The one-primary-multiple-read-only architecture provides high availability by default. No additional configuration is required. |
Driver compatibility | Natively supports all official MongoDB drivers and ecosystem tools. | Compatible with the MongoDB protocol. Supports mainstream MongoDB drivers and ecosystem tools such as mongosh. For more information, see Drivers and ecosystem tools. |
Availability and reliability
Dimension | self-managed MongoDB | PolarDB document database (compatible with the MongoDB protocol) |
Multi-region and multi-zone disaster recovery | You must manually deploy replica set members across zones. Configuration is complex and network latency must be optimized by yourself. | Supports multi-region and multi-zone deployment. Disaster recovery is provided by the cloud platform. For more information, see Global Database Network (GDN). |
Backup | You must write your own backup scripts or use tools such as mongodump. Backup strategies and storage management must be maintained manually. | Provides automatic backup with support for full backups and incremental backups. Backup policies can be configured in the console. For more information, see Manage backups. |
Recovery | Recovery relies on manual backup files. Point-in-time recovery to a specific timestamp is not supported. | Supports point-in-time recovery (PITR) to restore data to a specific second-level timestamp. For more information, see Cluster recovery: Point-in-time recovery (PITR). |
Storage reliability | Depends on the underlying storage medium. RAID or distributed storage must be configured manually to ensure data reliability. | Distributed storage with multiple replicas. Data reliability is ensured by the storage layer. |
Elasticity and scaling
Dimension | self-managed MongoDB | PolarDB document database (compatible with the MongoDB protocol) |
Read scaling | Read capacity is scaled by adding secondary nodes, but read/write splitting logic must be configured manually. | Supports adding read-only nodes and provides a built-in read/write splitting proxy. Read requests are distributed to read-only nodes without application changes. |
Storage scaling | Storage expansion requires downtime or complex online expansion operations, which may cause service interruptions. | Storage capacity scales automatically on demand. No pre-allocation is required. |
Elastic scaling | Elastic scaling requires external monitoring systems and custom scripts, resulting in slow response times. | Supports Serverless elastic scaling that automatically adjusts compute resources based on business load with pay-as-you-go billing. For more information, see Enable serverless for fixed-specification clusters. |
Independent compute and storage scaling | Not supported. Compute and storage are bound to the same node and must be scaled at the same time. | Compute nodes and storage capacity are fully decoupled and can be scaled independently on demand without affecting each other. |
Summary
Compared with self-managed MongoDB, the PolarDB for MySQL document database (compatible with the MongoDB protocol) capability provides the following core advantages:
Maintenance-free: fully managed service that eliminates the need for infrastructure O&M, version upgrades, and patch installation.
High availability: one-primary-multiple-read-only architecture that provides high availability by default, along with automatic failover, automatic backup, and point-in-time recovery.
Elastic scaling: compute-storage separation architecture that supports independent scaling. The Serverless capability automatically adjusts resources based on load.
Protocol compatibility: compatible with the MongoDB protocol and supports mainstream drivers and ecosystem tools for seamless integration.
Multi-region and multi-zone disaster recovery: supports Global Database Network (GDN) for cross-region, low-latency access.
To migrate from self-managed MongoDB to the PolarDB for MySQL document database capability compatible with the MongoDB protocol, see Migrate data from MongoDB to document database (MongoDB-compatible).