PolarDB for MySQL is highly compatible with document databases. This allows your applications to connect seamlessly using standard document database drivers, such as pymongo for Python, mongoose for Node.js, and the official MongoDB driver for Go, without changing your business code. In addition to API compatibility, this feature integrates the core enterprise-grade capabilities of the PolarDB cloud-native database. These capabilities include elastic scaling in seconds, massive data storage, and finance-grade high availability. This provides a cost-effective and high-performance NoSQL solution.
This feature is in canary release. If you want to use this feature, submit a ticket. We will enable it for you.
Feature overview
PolarDB for MySQL uses compute nodes to provide compatibility with document database APIs. Understanding how this feature works helps you use it more effectively.
Database proxy layer (Proxy)
The proxy layer is the core of protocol conversion. It accepts BSON requests from clients, performs identity authentication, parses protocols, and routes requests. The proxy layer then transforms document database operations into SQL statements that MySQL can recognize. It intelligently dispatches these statements to the most suitable backend compute node. This design decouples the protocol compatibility logic from the database kernel. This lets you reuse the mature connection pool, load balancing, and read/write splitting features of PolarDB.
Database compute nodes
Compute nodes use a high availability (HA) architecture with one primary node and multiple read-only nodes. The Enterprise Edition supports up to 15 read-only nodes, and the Standard Edition supports up to 7 read-only nodes. The primary node handles all write operations, and the read-only nodes handle read requests. The compute layer is based on the standard MySQL kernel and is adapted to handle minor differences in BSON types, such as collations, operators, and indexes. This minimally modified design ensures that the feature is maintainable and can quickly adopt major version updates from the MySQL community. You do not need to create databases, tables, or define table schemas. This provides a collection management experience consistent with document databases.
Advantages
Smooth migration: This feature is highly compatible with document database APIs. You can connect your existing applications and business systems without refactoring code and continue to use your NoSQL development practices. Data migration using DTS is also supported.
Unified data platform: You can use the same data for both flexible NoSQL reads and writes and for complex queries and analysis with standard SQL. This unifies your operational and analytical data.
Elasticity and cost-effectiveness: This feature uses a compute-storage decoupled architecture.
Storage is billed based on actual usage and scales up to 1 PB.
Compute nodes can be scaled up or down in minutes as needed. You can also enable the serverless feature on a cluster with defined specifications to achieve elastic scaling in seconds based on PolarDB Capacity Units (PCUs). This effectively reduces resource costs.
Enterprise-grade reliability: This feature is built on the mature high availability architecture of PolarDB to ensure data security and business continuity.
Scope
Before you use the document database compatibility feature, make sure that your cluster version meets the following requirements:
Kernel version: MySQL 8.0.2.
Other limitations:
Multi-master Cluster (Limitless) Edition and serverless clusters do not support the document database compatibility feature.
Clusters with Orca (Redis-compatible) enabled do not support the document database compatibility feature.
Go to the PolarDB console. On the page of your cluster, view the version information. If the version does not meet the requirements, upgrade the minor version.
Billing
The document database compatibility feature does not incur additional fees. You are charged only for the PolarDB for MySQL cluster. For more information, see Billing.
What to do next
After you review the feature overview, follow the instructions in Usage notes to create a cluster, configure an account, and verify the initial connection.