CosmosDB API for MongoDB benefits and restrictions?

Hi all

We’re about to start one of our projects using MongoDB - we have requirement that project needs to be deployed to Azure services but also it should be cloud-agnostic as well so we can easily switch to another solution if needed.

Since I don’t have experience with CosmosDB and it’s api for MongoDB, can someone pls provide more details about:

  • restrictions (if exists in terms of cloud-agnostic) using cosmos api for mongoDB?
  • is there any MongoDB Net Core library we can use to work with ComsosDB directly - if yes what are the benefits using mongoDB net core library over cosmos api for mongoDB etc?

Much appreciated.

Thanks.

Welcome to the MongoDB community @Adnan_Brotlic!

If you want a cloud-agnostic managed database solution, you should be using MongoDB Atlas. Atlas supports the major cloud providers (Azure, AWS, and GCP) and is using the latest genuine MongoDB Enterprise server versions with full feature support. Atlas is integrated with Azure and even supports Mutli-Cloud Clusters for full portability. You can also use MongoDB Community or Enterprise Server for development or self-hosted deployments.

Cosmos provides incomplete emulation for a subset of MongoDB API features and has a distinct underlying server implementation. Cosmos’ provisioning and billing mechanisms are based around Request Units and the API behaviour is not fully cloud-agnostic.

Official MongoDB drivers aren’t tested with Cosmos’ emulation and you can’t rationalise server behaviour (for example, indexing or sharding) based on MongoDB server knowledge. Cosmos is passable if you have extremely basic requirements, but the majority of the community discussion I’ve encountered is about compatibility issues (for example, azure-cosmosdb-mongoapi questions on Stack Overflow).

For a general overview of MongoDB vs emulated APIs, see MongoDB Atlas Comparison.

Regards,
Stennie

2 Likes

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.