Author : MD TAREQ HASSAN | Updated : 2021/03/17

CosmosDB vs MongoDB

Configurations for comaprison

---------------------- CosmosDB
Database Operation: Serverless
Write Region: Single region write (Japan East)
Provisioned throughput (RUs): 400
Transactional Storage: 3 GB
Backup Type: Continous

---------------------- MongoDB Community Edition hosted in Azure VM
VM SKU: D2 v4
CPU: 2 vCores
Storage: Standard SSD
OS: Linux (CentOS)
Auto-scalling: Scale-sets with 2 VMs (in same region)

---------------------- MongoDB Atlas in Azure Cloud
Cluster path: Dedicated cluster
Cluster tier: M30
vCPUs: 2
Storage: 32 GB (Premium storage disks)
Criteria CosmosDB MongoDB Community Edition
hosted in Azure VM
MongoDB Atlas
in Azure Cloud
(Approx.) Cost per month $120
(actual cost might be $350 ~ $500)
$100 (VM)
$180 (scale-set)
Pros ● SLA is high (99.999%), so negligible downtime
● A multi-model, multi-API database service
● Easy to maintain
● Easy integration with other Azure services
● Enterprise-grade security
● Azure role-based access control keeps your data safe and offers fine-tuned control
● Enterprise-grade encryption-at-rest with self-managed keys
● Document size up to 16 MB
● Easy Backup and Restore
● Complete control (deploy, manage, configure etc.)
● MongoDB Community edition is free
● Supports core MongoDB features that are enough for most cases
● Document size up to 16 MB
● Easy Backup and Restore
● Fully managed DaaS (Database as a Service) in the Cloud
● Fully elastic (auto-scalling of both cluster and storage)
● Great developer experience
● Runs MongoDB Enterprise
● Lower Management cost
● Supports all MongoDB features
Cons / Limitations ● Document size limit (Max 2 MB)
● Issues with backup & restore
● Cost is relatively high
● CosmosDB’s MongoDB API does not support all MongoDB features
● Maintenance overhead (effort & cost, manual patch & update)
● 8.77 hours downtime per year since relatively lower SLA i.e. 99.90%
● VM scale-sets have additonal cost
● Lack of support from vendor
● Possibility of presence of bugs
● The input/output operations per second (IOPS) the system can perform is fixed
● Backup and Restore is available for M10+ Clusters only
● Not included in existing subscriptions of Azure, requires an additional support plan and reliance on a third party
● A migration is considered as usage & failed migrations are billed
● Limited Nesting (max 100 levels)
● migration will fail for documents that are more then 200 deep
● Concurrent connection limit: 3000