title | description | keywords | services | author | manager | ms.service | ms.component | ms.devlang | ms.topic | ms.date | ms.author | experimental | experiment_id |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Introduction to Azure Cosmos DB: MongoDB API | Microsoft Docs |
Learn how you can use Azure Cosmos DB to store and query massive volumes of JSON documents with low latency using the popular OSS MongoDB APIs. |
what is MongoDB |
cosmos-db |
SnehaGunda |
slyons |
cosmos-db |
cosmosdb-mongo |
na |
overview |
02/12/2018 |
sclyon |
true |
662dc5fd-886f-4a |
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 databases can be used as the data store for apps written for MongoDB. This functionality means that by using existing drivers, your application written for MongoDB can now communicate with Azure Cosmos DB and use Azure Cosmos DB databases instead of MongoDB databases. In many cases, you can switch from using MongoDB to Azure Cosmos DB by simply changing a connection string. Using this functionality, you can easily build and run MongoDB globally distributed database applications in the Azure cloud with Azure Cosmos DB and it's comprehensive industry-leading SLAs, while continuing to use familiar skills and tools for MongoDB.
MongoDB compatibility: You can use your existing MongoDB expertise, application code, and tooling as Azure Cosmos DB implements the MongoDB wire protocol. You can develop applications using MongoDB and deploy them to production using the fully managed, and globally distributed Azure Cosmos DB service. For more information on supported versions see MongoDB Protocol Support.
Elastically scalable throughput and storage: Meet your applications needs by easily scaling up or down your MongoDB database. Your data is stored on solid-state disks (SSD) for low predictable latencies. Azure Cosmos DB supports MongoDB collections that can scale to virtually unlimited storage sizes and provisioned throughput. You can elastically scale Azure Cosmos DB with predictable performance seamlessly as your application grows.
Multi-region replication: Azure Cosmos DB transparently replicates your data to all regions you've associated with your MongoDB account, enabling you to develop applications that require global access to data while providing tradeoffs between consistency, availability, and performance, all with corresponding guarantees. Azure Cosmos DB provides transparent regional failover with multi-homing APIs, and the ability to elastically scale throughput and storage across the globe. Learn more in Distribute data globally.
No server management: You don't have to manage and scale your MongoDB databases. Azure Cosmos DB is a fully managed service, which means you do not have to manage any infrastructure or Virtual Machines yourself. Azure Cosmos DB is available in 30+ Azure Regions.
Tunable consistency levels: Because Azure Cosmos DB supports multi-model APIs the consistency settings are applicable at the account level and enforcement of the consistency is controlled by each API. Until MongoDB 3.6, there was no concept of a session consistency, so if you set a MongoDB API account to use session consistency, the consistency is downgraded to eventual when using MongoDB APIs. If you need a read-your-own-write guarantee for a MongoDB API account, the default consistency level for the account should be set to strong or bounded staleness. Learn more in Using consistency levels to maximize availability and performance.
Azure Cosmos DB Default Consistency Level | Mongo API (3.4) |
---|---|
Eventual | Eventual |
Consistent Prefix | Eventual with consistent order |
Session | Eventual with consistent order |
Bounded Staleness | Strong |
Strong | Strong |
Automatic indexing: By default, Azure Cosmos DB automatically indexes all the properties within documents in your MongoDB database and does not expect or require any schema or creation of secondary indices. In addition, the unique index capability enables a uniqueness constraint on any document fields that are already auto-indexed in Azure Cosmos DB.
Enterprise grade: Azure Cosmos DB supports multiple local replicas to deliver 99.99% availability and data protection in the face of local and regional failures. Azure Cosmos DB has enterprise grade compliance certifications and security features.
Follow the MongoDB quickstarts to create an Azure Cosmos DB account and migrate your existing MongoDB application to use Azure Cosmos DB, or build a new one:
- Migrate an existing Node.js MongoDB web app.
- Build a MongoDB API web app with .NET and the Azure portal
- Build a MongoDB API console app with Java and the Azure portal
Information about the Azure Cosmos DB MongoDB API is integrated into the overall Azure Cosmos DB documentation, but here are a few pointers to get you started:
- Follow the Connect to a MongoDB account tutorial to learn how to get your account connection string information.
- Follow the Use Studio 3T (MongoChef) with Azure Cosmos DB tutorial to learn how to create a connection between your Azure Cosmos DB database and MongoDB app in Studio 3T.
- Follow the Migrate data to Azure Cosmos DB with protocol support for MongoDB tutorial to import your data to an API for MongoDB database.
- Connect to an API for MongoDB account using Robomongo.
- Learn how to configure read preferences for globally distributed apps.