Azure Cosmos DB's API for MongoDB
APPLIES TO: Azure Cosmos DB API for MongoDB
Azure Cosmos DB is Microsoft's globally distributed, multi-model database service for mission-critical applications. Azure Cosmos DB provides turn-key global distribution, elastic scaling of throughput and storage worldwide, single-digit millisecond latencies at the 99th percentile, and guaranteed high availability, all backed by industry-leading SLAs. Azure Cosmos DB automatically indexes data without requiring you to deal with schema and index management. It is multi-model and supports document, key-value, graph, and columnar data models. Azure Cosmos DB service implements wire protocols for common NoSQL APIs including Cassandra, MongoDB, Gremlin, and Azure Table Storage. This allows you to use your familiar NoSQL client drivers and tools to interact with your Cosmos database.
The serverless capacity mode is now available on Azure Cosmos DB's API for MongoDB.
Wire protocol compatibility
Azure Cosmos DB implements the wire protocol for MongoDB. This implementation allows transparent compatibility with native MongoDB client SDKs, drivers, and tools. Azure Cosmos DB does host the MongoDB database engine. The details of the supported features by MongoDB can be found here:
By default, new accounts created using Azure Cosmos DB's API for MongoDB are compatible with version 3.6 of the MongoDB wire protocol. Any MongoDB client driver that understands this protocol version should be able to natively connect to Cosmos DB.
The key benefits of Cosmos DB as a fully managed, globally distributed, database as a service are described here. Additionally, by natively implementing wire protocols of popular NoSQL APIs, Cosmos DB provides the following benefits:
- Easily migrate your application to Cosmos DB while preserving significant portions of your application logic.
- Keep your application portable and continue to remain cloud vendor-agnostic.
- Get industry leading, financially backed SLAs for the common NoSQL APIs powered by Cosmos DB.
- Elastically scale the provisioned throughput and storage for your Cosmos databases based on your need and pay only for the throughput and storage you need. This leads to significant cost savings.
- Turnkey, global distribution with multi-region writes replication.
Cosmos DB's API for MongoDB
Follow the quickstarts to create an Azure Cosmos account and migrate your existing MongoDB application to use Azure Cosmos DB, or build a new one:
- Migrate an existing MongoDB Node.js web app.
- Build a web app using Azure Cosmos DB's API for MongoDB and .NET SDK
- Build a console app using Azure Cosmos DB's API for MongoDB and Java SDK
Here are a few pointers to get you started:
- Follow the Connect a MongoDB application to Azure Cosmos DB tutorial to learn how to get your account connection string information.
- Follow the Use Studio 3T with Azure Cosmos DB tutorial to learn how to create a connection between your Cosmos database and MongoDB app in Studio 3T.
- Follow the Import MongoDB data into Azure Cosmos DB tutorial to import your data to a Cosmos database.
- Connect to a Cosmos account using Robo 3T.
- Learn how to Configure read preferences for globally distributed apps.
- Find the solutions to commonly found errors in our Troubleshooting guide
Note: This article describes a feature of Azure Cosmos DB that provides wire protocol compatibility with MongoDB databases. Microsoft does not run MongoDB databases to provide this service. Azure Cosmos DB is not affiliated with MongoDB, Inc.