Leverage your MongoDB skills on Azure Cosmos DB

Collin Brian

You understand the value of the flexibility and scalability of NoSQL databases. The document model, using a JSON style data format, supports dynamic schemas that are easy to read/write and fast for machines to parse. Though if you want to truly unlock the potential of the distributed nature and horizontal scalability of NoSQL databases, you should consider running those databases in the cloud. Azure Cosmos DB is a fully-managed NoSQL database with an API for MongoDB. It provides cost-effective pricing models, enables fast and flexible application development, and is capable of running mission critical workloads. In this post, we’ll discuss how to use your existing MongoDB skills on Azure Cosmos DB.


Use Familiar Syntax and Commands

The Azure Cosmos DB API for MongoDB is based on a wire protocol implementation, which gives you the best of both worlds: leverage your skillset in MongoDB and JSON objects, while also gaining all the benefits of Azure Cosmos DB. This lets you use the libraries, drivers, and frameworks of the MongoDB you’re used to, all while capitalizing upon the performance and scalability of Azure Cosmos DB. It also means that you can build with existing data and apps because of the compatibility with MongoDB v3.6, which provides comprehensive support for MongoDB query language constructs. A detailed list of currently supported operations, operators, stages, commands, and options can be found in documentation.


The Azure Cosmos DB API for MongoDB powers production applications at Bentley Systems, and is integral to Azure Advanced Threat Protection and Microsoft 365.


Dev/Test Free… then Scale

Run a workload of any size with greater control of the cost. Free Tier (400 RU/s and 5GB per month free) paired with Autoscale throughput allows you to run low-cost, scalable apps on Azure Cosmos DB. Develop, test, and even deploy for free with the capability to automatically scale up and down based on usage.

Alternatively, you could leverage the new Serverless model, the only serverless MongoDB on the market. Serverless is a cost-effective way to run small, spiky workloads. With this consumption-based model, you are charged for the Request Units (RU) used by your requests and the storage consumed by your data. This means that there’s no minimum cost when using serverless – you only pay for what you use.

Pick the right model for your workload

Still not sure which to use? This guide will help you decide.


Build on or Migrate to the API for MongoDB

Create an Account:

Image of process of creating Cosmos DB Account
Example account creation details

Build a new app:

Migrate your data:

  • Azure Database Migration Service is great for migrating your data from MongoDB (either on-prem or a managed instance in the cloud) to the API for MongoDB 
  • Not ready to move to a full platform-as-a-service offer? You can take progressive steps to the cloud by migrating from MongoDB to a Windows VM in Azure or a Linux VM in Azure 

Take a closer look:


Top 3 Reasons to Consider Azure Cosmos DB and the API for MongoDB

1 Fully Managed and Cost-Effective
As a fully-managed database service, Azure Cosmos DB automatically handles all maintenance, patching, and updates, saving you money and time that can be used to focus on application development/management

Cost-effective options enable you to run workloads without having to plan or manage capacity. The three major features that make this possible are:

  • Standard provisioned throughput – for workloads with steady or predictable traffic
  • Autoscale provisioned throughput – automatically, transparently, and instantly scales your database to closely match the workload requirements with hourly adjustments
  • Serverless (in Public Preview) – supports burstable or infrequent operations, only billing you for resources used for each database operation
2 Fast and Flexible Application Development
Supports the wire protocols of commonly used NoSQL APIs including MongoDB, which makes it possible to leverage your skillset and easily migrate workloads while preserving significant portions of application logic

Instantaneous automatic scaling that abstracts away all the operational complexity associated with maintaining replicas and shards of your data. Choose a good data model and an efficient shard [partition] key and Azure Cosmos DB can limitlessly scale data and throughput

Unlike MongoDB, you choose from five well-defined consistency levels that provide granular tradeoffs with respect to availability, latency, and throughput

Deeply integrated with key Azure services used in cloud-native application development including Azure Functions, IoT Hub, AKS (Azure Kubernetes Service), App Service, and more

Azure Synapse Link for Azure Cosmos DB, a cloud-native implementation of HTAP, enables near real-time insights over MongoDB data through Synapse Spark or Synapse SQL

3 Mission Critical Ready
Geo-distributed with multi-region writes, and active/active data replication to any Azure region made possible with the click of a button

Industry leading, financially backed SLAs for high availability, throughput, and consistency

Enterprise-level security with encryption-at-rest, access control, and more


About Azure Cosmos DB

Azure Cosmos DB is a fully managed NoSQL database for modern and cloud-native app development, with SLA-backed speed and availability, automatic and instant scalability, and an open source API for MongoDB (among other APIs).

For more information you can visit http://azurecosmosdb.com


Discussion is closed.

Feedback usabilla icon