Cosmos DB and Azure DocumentDB
|
This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production. See the section bibliography for the reference material consulted while preparing these pages. |
Examples on this page target Azure CLI 2.90.0 — re-verify exact flag names against
the az cosmosdb command reference and
the az cosmosdb mongocluster reference, part of the
cosmosdb-preview extension before relying on them, since the DocumentDB surface in particular is still moving
quickly.
This page covers two related but distinct Azure database products. Azure Cosmos DB is Microsoft’s multi-API,
request-unit-priced globally distributed database: the account/database/container model, partition keys and the
hot-partition pitfalls that follow from them, request units (RUs) and the provisioned/autoscale/serverless pricing
choices, the five consistency levels, global distribution and multi-region writes, continuous backup, data-plane
RBAC, and the local emulator. Azure DocumentDB is the separately-branded, MongoDB-wire-protocol-compatible
cluster product — formerly called "Cosmos DB for MongoDB (vCore)" until it was renamed in November 2025 — covered
in its own section together with a comparison against MongoDB Atlas on Azure and against Cosmos DB’s own
RU-based MongoDB API. Bookshelf’s order history lives in a Cosmos DB for NoSQL account/database named orders
(account docdb-bookshelf), used as the running example throughout; the DocumentDB section reuses the same
docdb-bookshelf name for the vCore cluster it walks through separately.
The account, database and container model
An Azure Cosmos DB account is the top-level resource: it fixes the API (below), the Azure regions the data is replicated to, and the account-wide settings (consistency default, capacity mode, network rules) that every database underneath it inherits. Within an account:
- Database
-
A namespace grouping containers, analogous to a schema. A database can optionally be provisioned with its own shared throughput, split across the containers inside it that don’t have their own dedicated throughput.
- Container
-
The unit of scalability and the unit that actually stores items (documents, rows, nodes/edges, depending on API) — analogous to a table/collection. A container’s partition key is fixed at creation and cannot be changed afterward (Partition keys and hot-partition pitfalls); its throughput is either dedicated to it or shared from its parent database.
APIs
The same underlying engine is exposed through five wire-protocol-compatible APIs, chosen once per account and fixed thereafter:
| API | What it looks like to a client |
|---|---|
NoSQL (formerly "SQL API") |
Cosmos DB’s native API: JSON documents, a SQL-like query language, and the first-class SDK surface — the API
Bookshelf’s |
MongoDB (RU-based) |
Speaks the MongoDB wire protocol against Cosmos DB’s own RU-priced engine — distinct from Azure DocumentDB (Azure DocumentDB), which is a different product built on genuinely MongoDB-compatible, vCore-priced clusters. |
Cassandra |
Speaks the CQL wire protocol against the same RU-priced engine, for teams migrating an existing Cassandra workload without re-platforming client code. |
Gremlin |
A property-graph API (vertices and edges) using the Apache TinkerPop Gremlin traversal language. |
Table |
A key-value API compatible with the older Azure Table Storage surface, with Cosmos DB’s global distribution and indexing added on top. |
References: What is Azure Cosmos DB?, Choose an API in Azure Cosmos DB.
Partition keys and hot-partition pitfalls
Every item in a container carries a partition key — a property (or, since composite partition keys, several) whose value groups items into logical partitions. Cosmos DB transparently maps logical partitions onto physical partitions, splitting and rebalancing them automatically as data and throughput grow; an application never addresses a physical partition directly, but its choice of partition key entirely determines how RU throughput and storage get spread across them. The figure below shows the mapping and the pitfall that follows from it:
A well-chosen partition key (Bookshelf uses customerId for its orders container) has high cardinality and
spreads both storage and request volume evenly. A hot partition results from a key with low cardinality or a
skewed access pattern — a single logical partition value that draws disproportionate RU demand (a celebrity
product SKU, a single large tenant in a multi-tenant container, a key derived from a coarse date bucket that
every write of the day lands on) — because provisioned RU/s is split roughly evenly across physical partitions,
not pooled across the container: a hot logical partition can throttle (HTTP 429, TooManyRequests) even while
the container’s aggregate RU/s utilization looks low. az cosmosdb sql container throughput show (and the
portal’s Insights → Throughput → Normalized RU Consumption by PartitionKeyRangeId view) surface this
per-physical-partition skew; the fix is almost always changing the partition key (which requires recreating the
container and migrating data, since the key is immutable), never simply raising throughput.
Request units and throughput modes
A request unit (RU) is Cosmos DB’s normalized cost currency for every database operation — a 1 KB point read costs roughly 1 RU; a point write, a few times that (indexing every property adds further RU); a cross-partition query with no useful index can cost well over 100 RU. The figure above also breaks down approximate RU cost by operation type. Throughput is purchased in one of three modes, chosen per database (shared) or per container (dedicated):
| Mode | How it’s billed |
|---|---|
Provisioned (standard) |
A fixed RU/s reserved (and billed) whether or not it’s used, in increments of 100 RU/s (minimum 400 RU/s per container, or 400 RU/s shared across a database’s containers). |
Autoscale |
A maximum RU/s ceiling is set, and Cosmos DB scales actual provisioned RU/s between 10% of that ceiling and the
ceiling itself based on real-time usage, billed hourly for whatever the peak within that hour actually reached — useful for Bookshelf’s |
Serverless |
No RU/s is provisioned at all; each request is billed per RU actually consumed, with no minimum and no capacity to manage — well suited to low, spiky, or unpredictable traffic, at the cost of a per-container storage and throughput ceiling that provisioned/autoscale containers don’t have. |
In the Azure portal
-
Create a new Cosmos DB account (NoSQL API) and, on the Capacity mode step, choose Provisioned throughput or Serverless for the whole account (serverless is an account-wide choice, not a per-container one).
-
Inside the account, Data Explorer → New Container lets a provisioned-throughput account choose Autoscale or Manual and set the RU/s (or autoscale ceiling) and partition key path for that container.
With the Azure CLI
export RG=rg-bookshelf
export LOCATION=eastus2
export ACCOUNT=docdb-bookshelf
# Provisioned/autoscale account, Session consistency, single region for now (see <<global-distribution>>)
az cosmosdb create \
--name "$ACCOUNT" \
--resource-group "$RG" \
--locations regionName="$LOCATION" failoverPriority=0 isZoneRedundant=false \
--default-consistency-level Session
az cosmosdb sql database create \
--account-name "$ACCOUNT" \
--resource-group "$RG" \
--name orders
# Dedicated autoscale throughput, ceiling 4000 RU/s (floor scales to 400 RU/s automatically)
az cosmosdb sql container create \
--account-name "$ACCOUNT" \
--resource-group "$RG" \
--database-name orders \
--name order-events \
--partition-key-path "/customerId" \
--max-throughput 4000
# A separate serverless account, for a low-traffic, spiky workload
az cosmosdb create \
--name docdb-bookshelf-reporting \
--resource-group "$RG" \
--locations regionName="$LOCATION" \
--capabilities EnableServerless
The five consistency levels
Cosmos DB lets an account pick a default point on a well-defined consistency spectrum, trading read latency and availability against how strictly reads observe writes — and any individual request can override the account default to a weaker level (never a stronger one) at request time:
- Strong
-
Every read returns the most recent committed write, with no staleness window — the strongest and most expensive guarantee, and one Cosmos DB does not offer together with multi-region write availability.
- Bounded Staleness
-
Reads lag writes by at most a configured number of versions (
K) or a time interval (T), whichever is reached first — a middle ground that still gives a hard, quantified staleness bound. - Session
-
The default and most commonly chosen level: within a single client session (tracked via a session token), that client’s own writes are always visible to its own subsequent reads, even though a different client’s reads may briefly lag. Bookshelf’s
orderscontainer runs at Session. - Consistent Prefix
-
Reads never observe writes out of order (no gaps in the sequence), but may lag behind the latest write by an unspecified amount.
- Eventual
-
No ordering or recency guarantee at all — replicas converge eventually. Lowest latency and highest availability, appropriate only for data where staleness and even out-of-order reads are tolerable (view counters, like counts).
Strong and Bounded Staleness read from a quorum of replicas, which is why they carry roughly double the RU cost
per read compared to Session, Consistent Prefix, and Eventual (which read a single replica). The account default
is set at creation (--default-consistency-level above) and can be changed later, but changing it does not
retroactively affect data already replicated under the previous setting’s guarantees.
Global distribution and multi-region writes
A Cosmos DB account can replicate to any number of Azure regions, added or removed without downtime; each region holds a full copy of every partition. By default one region is designated the write region (single-write, multi-read) and the rest serve reads only, with automatic failover promoting a new write region by configured priority if the current one becomes unavailable; alternatively, an account can enable multi-region writes (sometimes still called multi-master), letting every region accept writes and relying on last-writer-wins (or a custom conflict resolution policy/stored procedure) to reconcile concurrent writes to the same item across regions. Multi-region writes trades that added complexity for the lowest possible write latency in every region and continuous write availability during a regional outage, and is incompatible with the Strong consistency level.
In the Azure portal
-
Open the
docdb-bookshelfaccount → Replicate data globally → Manage regions, pickWest US 2from the Region dropdown, select Add, then Save. The new region shows as a read region once its data has fully replicated. -
On the same Replicate data globally page, select Configure failover policy to drag the read regions into the order they should be promoted in during a service-managed failover.
-
To let every region accept writes, tick Multi-region writes in the page’s Configuration section and confirm — every existing read region becomes a read/write region.
With the Azure CLI
# Add a second (read) region, then promote it to enable multi-region writes
az cosmosdb update \
--name "$ACCOUNT" \
--resource-group "$RG" \
--locations regionName="$LOCATION" failoverPriority=0 isZoneRedundant=false \
--locations regionName=westus2 failoverPriority=1 isZoneRedundant=false
az cosmosdb update \
--name "$ACCOUNT" \
--resource-group "$RG" \
--enable-multiple-write-locations true
Continuous backup and point-in-time restore
Two backup modes exist, chosen at account creation and not changeable to the other mode afterward without
migrating: periodic backup (a full backup taken on an interval, restorable only by opening a support request)
and continuous backup, which streams changes continuously and allows a self-service restore to any point in
time within a 7-, 30-, or 35-day retention window (tier-dependent) into a new account — restoring in place
is not supported, since a restore always creates a separate target account. A restored account does not carry
over data-plane RBAC role assignments (Data-plane RBAC and disabling key-based auth); those must be re-applied to the restored account after the
restore completes. Continuous backup also requires a single write region, which is why the examples below use a
separate docdb-bookshelf-backup account rather than the multi-region-write docdb-bookshelf account above.
In the Azure portal
-
While creating the
docdb-bookshelf-backupaccount (Azure Cosmos DB → Create → Azure Cosmos DB for NoSQL), open the Backup Policy tab, choose Continuous, and pick the retention tier (for example 30 days). -
To restore, open the account → Point In Time Restore, enter the Restore Point (UTC), the Location, the Restore Resource (Entire account or selected databases/containers), the existing target Resource group, and the Restore Target Account name
docdb-bookshelf-restored, then select Submit. The Click here link next to the restore point opens an event feed of database/container creates, replaces and deletes to help choose the timestamp.
With the Azure CLI
az cosmosdb create \
--name docdb-bookshelf-backup \
--resource-group "$RG" \
--locations regionName="$LOCATION" \
--backup-policy-type Continuous \
--continuous-tier Continuous30Days
az cosmosdb restore \
--target-database-account-name docdb-bookshelf-restored \
--account-name docdb-bookshelf-backup \
--restore-timestamp "2026-09-01T12:00:00Z" \
--resource-group "$RG" \
--location "$LOCATION"
Data-plane RBAC and disabling key-based auth
Cosmos DB separates management-plane access (Azure RBAC roles like Contributor, controlling the account
resource itself) from data-plane access (reading/writing items), the latter authorized through Cosmos DB’s own
built-in role definitions (Cosmos DB Built-in Data Reader, Cosmos DB Built-in Data Contributor) assigned with
az cosmosdb sql role assignment create — distinct from, and not implied by, an Azure RBAC role on the account.
As with Blob Storage’s Shared Key model (see Identity and Access for the general Entra ID
pattern this mirrors), Cosmos DB also supports legacy primary/secondary account keys that bypass data-plane RBAC
entirely. Setting the account’s disableLocalAuth property to true rejects every key-authenticated data-plane
request, which forces every client onto Entra ID authentication via DefaultAzureCredential. (The separate
--disable-key-based-metadata-write-access flag only stops account keys from creating or changing databases and
containers; it does not stop keys from reading or writing data.)
In the Azure portal
-
When creating a new Cosmos DB for NoSQL account, open the Security step of the creation wizard and set Key-based authentication to Disable. For an existing account, use the CLI command below — the portal exposes this toggle only at creation time.
-
Data-plane role assignments (
Cosmos DB Built-in Data Contributorand friends) cannot be created or managed in the Azure portal — use the CLI below. The account’s Access control (IAM) blade only manages management-plane Azure RBAC roles.
With the Azure CLI
IDENTITY_PRINCIPAL_ID=$(az identity show --name id-orders-api --resource-group "$RG" --query principalId --output tsv)
ACCOUNT_ID=$(az cosmosdb show --name "$ACCOUNT" --resource-group "$RG" --query id --output tsv)
az cosmosdb sql role assignment create \
--account-name "$ACCOUNT" \
--resource-group "$RG" \
--role-definition-id 00000000-0000-0000-0000-000000000002 \
--principal-id "$IDENTITY_PRINCIPAL_ID" \
--scope "$ACCOUNT_ID"
# Disable key-based (primary/secondary key) authentication account-wide -- Entra ID only from now on
az resource update \
--resource-group "$RG" \
--name "$ACCOUNT" \
--resource-type "Microsoft.DocumentDB/databaseAccounts" \
--set properties.disableLocalAuth=true
CosmosAsyncClient client = new CosmosClientBuilder()
.endpoint("https://docdb-bookshelf.documents.azure.com:443/")
.credential(new DefaultAzureCredentialBuilder().build())
.buildAsyncClient();
References: Connect using role-based access control and Microsoft Entra ID (incl. disabling key-based authentication), Configure role-based access control with Microsoft Entra ID for your Azure Cosmos DB account, Set up role-based access control, Security in Azure Cosmos DB, az cosmosdb sql role assignment command reference.
The emulator
The Azure Cosmos DB Linux-based emulator runs as a Docker container (mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator)
on Linux, macOS, or Windows, exposing the NoSQL API locally with no Azure subscription or network access required — the successor to the older Windows-only emulator, which remains available but is no longer the recommended
starting point. It supports a useful but incomplete subset of server behavior (in particular, global distribution
and multi-region behavior cannot be exercised locally), so it is best treated as a fast inner-dev-loop and
integration-test target, not a substitute for testing against a real account before a release.
docker run --publish 8081:8081 --publish 10250-10255:10250-10255 \
--name cosmos-emulator \
mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator:latest
Azure DocumentDB
In November 2025, Microsoft renamed "Azure Cosmos DB for MongoDB (vCore)" to Azure DocumentDB — a first-party
rebrand of the same dedicated-cluster, MongoDB-wire-protocol-compatible product, not a retirement or a different
service. The name reuses "Azure DocumentDB", which from 2014 to 2017 was Microsoft’s name for the service that
became Azure Cosmos DB; neither should be confused with Amazon DocumentDB (AWS’s MongoDB-compatible service). The
open-source documentdb project is the engine today’s Azure DocumentDB is built on. Azure
DocumentDB is priced and operated like a managed MongoDB cluster (vCore-based compute and storage sized per node,
much closer to how MongoDB Atlas or a self-run mongod replica set is priced) rather than Cosmos DB’s RU model
covered above; the RU-priced Cosmos DB MongoDB API remains a separate, still-supported product for
workloads already built against it, and Microsoft’s own migration tooling (below) exists specifically because the
two are not the same underlying engine.
Cluster tiers, HA, and the free tier
A DocumentDB cluster is a set of shard nodes, each sized by a cluster tier (an M-series size, e.g. M10 through
larger M-series tiers, mirroring familiar MongoDB-hosting nomenclature) that determines vCPU, memory, and the
maximum IOPS/storage throughput per node. High availability (a synchronously replicated standby per shard) is
available starting at the M30 tier and up; vector index types requiring more memory (HNSW) are available
starting at M40 and up, while the lighter-weight IVF vector index type is available at every tier. A
Free Tier SKU provisions a single always-free cluster (32 GB storage) per subscription for the lifetime of
the account, with feature parity for CRUD/queries but without high availability, Entra ID authentication,
backup/restore, HNSW/DiskANN vector indexes, or diagnostic logging — it is meant for evaluation and small
personal projects, not production.
Entra authentication and vector search
Alongside DocumentDB’s native username/password authentication, paid tiers support Microsoft Entra ID
authentication for passwordless, managed-identity-based sign-in — the same DefaultAzureCredential pattern used
throughout this page and Identity and Access rather than a connection string with an
embedded password. Vector search is a first-class index type (IVF on every tier; HNSW and DiskANN on M40+),
letting an application store embeddings alongside its regular documents and run a MongoDB $search/aggregation
vector query against them without a separate vector database — directly relevant to Bookshelf’s product
recommendation feature, which stores embedding vectors next to each product document in the same cluster.
In the Azure portal
-
Create a resource → search for Azure DocumentDB → Create. On the Basics tab, select Configure under Cluster tier, choose
M30with 64 GiB storage per shard and high availability on, then Save; back on Basics, pickrg-bookshelf, name the clusterdocdb-bookshelf, choose the region and MongoDB version, and set the native admin username/password (store it in Key Vault, not in code). -
On the Networking tab, choose Public access and + Add current client IP address (or a private endpoint for production), then Review + create → Create.
-
Once deployed, open the cluster → Settings → Authentication, select Native DocumentDB and Microsoft Entra ID under Authentication methods, then Save.
-
On the same Authentication page, add the orders-api managed identity (and your own user, for testing) as a Microsoft Entra ID principal so it can sign in to the cluster.
With the Azure CLI
export CLUSTER=docdb-bookshelf
az cosmosdb mongocluster create \
--cluster-name "$CLUSTER" \
--resource-group "$RG" \
--location "$LOCATION" \
--administrator-login bookshelfadmin \
--administrator-login-password "$(openssl rand -base64 24)" \
--server-version 7.0 \
--shard-node-tier M30 \
--shard-node-count 1 \
--shard-node-ha true \
--shard-node-disk-size-gb 64
az cosmosdb mongocluster database create \
--cluster-name "$CLUSTER" \
--resource-group "$RG" \
--database-name orders
# Allow Microsoft Entra ID sign-in alongside native auth (documentdb CLI extension)
az documentdb mongocluster update \
--name "$CLUSTER" \
--resource-group "$RG" \
--auth-allowed-modes NativeAuth MicrosoftEntraID
# Register the orders-api managed identity (a service principal) with readWrite on the orders database
IDENTITY_PRINCIPAL_ID=$(az identity show --name id-orders-api --resource-group "$RG" --query principalId --output tsv)
az documentdb mongocluster microsoft-entra-user assign \
--cluster-name "$CLUSTER" \
--resource-group "$RG" \
--object-id "$IDENTITY_PRINCIPAL_ID" \
--type ServicePrincipal \
--role db=orders role=readWrite
References: az cosmosdb mongocluster command reference, Introduction to Azure DocumentDB, Free tier - Azure DocumentDB, Vector search in Azure DocumentDB, Quickstart: create an Azure DocumentDB cluster in the portal, Connect using role-based access control and Microsoft Entra ID, az documentdb mongocluster microsoft-entra-user command reference.
Connecting: mongosh and the Java driver
mongosh connects with a standard MongoDB connection string obtained from the cluster’s Connection strings
blade for interactive use; application code should instead authenticate through Entra ID rather than embedding
the administrator password:
mongosh "mongodb+srv://bookshelfadmin@docdb-bookshelf.global.mongocluster.cosmos.azure.com/orders?tls=true&authMechanism=SCRAM-SHA-256&retrywrites=false&maxIdleTimeMS=120000"
TokenCredential credential = new DefaultAzureCredentialBuilder().build();
TokenRequestContext tokenRequest =
new TokenRequestContext().addScopes("https://ossrdbms-aad.database.windows.net/.default");
// Machine (workload) callback: the driver invokes it on first connect and again whenever the server asks for
// re-authentication, so each call fetches a fresh Entra token instead of reusing one that expires after ~1 hour.
MongoCredential mongoCredential = MongoCredential.createOidcCredential(null)
.withMechanismProperty(MongoCredential.OIDC_CALLBACK_KEY,
(MongoCredential.OidcCallback) context -> {
AccessToken token = credential.getTokenSync(tokenRequest);
// Passing the remaining lifetime lets the driver refresh proactively before expiry
return new MongoCredential.OidcCallbackResult(token.getToken(),
Duration.between(Instant.now(), token.getExpiresAt().toInstant()));
});
MongoClientSettings settings = MongoClientSettings.builder()
.applyConnectionString(new ConnectionString(
"mongodb+srv://docdb-bookshelf.global.mongocluster.cosmos.azure.com/orders"
+ "?tls=true&authMechanism=MONGODB-OIDC&retrywrites=false&maxIdleTimeMS=120000"))
.credential(mongoCredential)
.build();
MongoClient mongoClient = MongoClients.create(settings);
OIDC_CALLBACK_KEY is the driver’s machine (workload) callback, the right choice for a managed identity or
service principal; OIDC_HUMAN_CALLBACK_KEY is reserved for interactive, human sign-in flows with refresh tokens.
The token scope https://ossrdbms-aad.database.windows.net/.default is the one Microsoft’s own DocumentDB samples
request.
Migrating from MongoDB, and from the Cosmos DB MongoDB RU API
Two distinct migration paths exist, and neither is a same-engine, drop-in move:
-
From a self-hosted or Atlas MongoDB deployment, the Azure Database Migration Service and the MongoDB Migration extension for VS Code both support an online (change-stream-based, low-downtime) migration into a DocumentDB cluster.
-
From an existing Cosmos DB for MongoDB (RU) account, Microsoft provides a dedicated portal-driven live migration path directly into a DocumentDB cluster — necessary specifically because the RU API and DocumentDB are different engines under a shared "MongoDB API" marketing umbrella, not interchangeable deployments of the same one.
Comparison: MongoDB Atlas on Azure vs. DocumentDB vs. Cosmos DB MongoDB (RU)
| MongoDB Atlas on Azure | Azure DocumentDB | Cosmos DB for MongoDB (RU) | |
|---|---|---|---|
Pricing model |
Instance-based (Atlas’s own M-tier sizes) or Atlas Serverless; billed by MongoDB, not Azure, though purchasable through Azure Marketplace commitment. |
vCore/instance-based (Azure M-tier sizes per shard node); billed by Azure. |
Request units (provisioned, autoscale, or serverless); billed by Azure. |
Underlying engine |
Genuine MongoDB (Atlas’s own distribution). |
The open-source DocumentDB engine, MongoDB-wire-protocol-compatible. |
Cosmos DB’s native engine translating the MongoDB wire protocol — a partial, RU-costed emulation, not MongoDB itself. |
Where it’s operated |
MongoDB’s own control plane, deployed into Azure regions; support and billing relationship is with MongoDB. |
Azure’s own control plane ( |
Azure’s own control plane ( |
High availability |
Built in to every paid tier (multi-node replica set by default). |
|
Built in via Cosmos DB’s own multi-region replication model. |
Free tier |
Atlas free forever |
One always-free cluster per subscription, 32 GB, without HA/Entra/backup/vector-HNSW. |
No dedicated free tier SKU as of this writing (subject to the general Cosmos DB free-tier terms Microsoft publishes and periodically changes). |
Entra ID / managed identity auth |
Not natively — Atlas has its own IAM/database-user model, with Azure AD federation only via Atlas’s own workforce-identity integrations. |
Yes, on paid tiers ( |
Yes, via Cosmos DB’s own Entra ID data-plane RBAC (Data-plane RBAC and disabling key-based auth), layered onto MongoDB-API access. |
Vector search |
Atlas Vector Search, mature and widely used. |
IVF on every tier; HNSW/DiskANN on |
Supported, with its own indexing options distinct from DocumentDB’s. |
Best fit |
Teams already standardized on Atlas across clouds, or wanting Atlas’s own tooling/support. |
New MongoDB-shaped workloads that want to stay entirely inside Azure billing/IAM, with genuine MongoDB compatibility. |
Existing MongoDB-API Cosmos DB workloads, or teams that specifically want RU-based serverless/autoscale pricing rather than cluster sizing. |
Bookshelf’s orders service is modeled on this page using the NoSQL API’s docdb-bookshelf account for the
canonical example, with the DocumentDB CLI walkthrough above showing the alternative MongoDB-compatible path
under the same resource name for a team that would rather keep the driver/tooling MongoDB-native.
Pricing and what changed recently
Cosmos DB’s RU-based pricing (provisioned/autoscale/serverless, plus storage and networking) is published at the Cosmos DB pricing page; DocumentDB’s vCore-based pricing (per shard-node tier, storage, and backup) is published separately at the Azure DocumentDB pricing page — the two are not on a shared price list, matching their different billing models above. The most consequential recent change is the November 2025 rename covered in Azure DocumentDB: any documentation, blog post, or third-party tooling still referring to "Cosmos DB for MongoDB (vCore)" is describing today’s Azure DocumentDB under its former name, not a separate or deprecated product. Treat any specific rate or free-tier term stated on this page as indicative, not contractual, and re-check both pricing pages plus the Azure DocumentDB release notes before committing to a sizing decision.
MongoDB reference
Application-level MongoDB concepts — documents and BSON, the aggregation pipeline, indexes, sharding, replication, drivers — apply equally whether the backing service is Atlas, self-hosted MongoDB, or Azure DocumentDB’s MongoDB-compatible cluster; they are covered in depth on the MongoDB reference rather than repeated here. This page’s Cosmos DB NoSQL sections above cover Cosmos-specific concepts (partitioning, RUs, consistency levels) that have no MongoDB equivalent.
Clean up
az group delete --name "$RG" --yes --no-wait
This removes every Cosmos DB account and DocumentDB cluster created in $RG on this page, including
docdb-bookshelf and any restored/backup accounts. A locked continuous-backup retention setting does not block
this account-level deletion the way a locked immutability policy blocks a Blob Storage container delete.
References
-
Microsoft Learn — Partitioning and horizontal scaling in Azure Cosmos DB
-
Microsoft Learn — Model and partition data in Azure Cosmos DB using a real-world example
-
Microsoft Learn — Monitor normalized request unit (RU/s) consumption
-
Microsoft Learn — Provision throughput for a container or a database
-
Microsoft Learn — az cosmosdb sql database command reference
-
Microsoft Learn — az cosmosdb sql container command reference
-
Microsoft Learn — Consistency, availability, and performance tradeoffs
-
Microsoft Learn — Distribute data globally with Azure Cosmos DB
-
Microsoft Learn — Continuous backup with point-in-time restore
-
Microsoft Learn — Provision an account with continuous backup
-
Microsoft Learn — Restore an account that uses continuous backup
-
Microsoft Learn — az cosmosdb sql role assignment command reference
-
Microsoft Learn — Use the Azure Cosmos DB emulator for local development and testing
-
Microsoft Learn — az cosmosdb mongocluster command reference
-
Microsoft Learn — Connect to Azure DocumentDB using role-based access control and Microsoft Entra ID
-
Microsoft Learn — az documentdb mongocluster microsoft-entra-user command reference
-
Microsoft Learn — Connect to Azure Cosmos DB using role-based access control and Microsoft Entra ID
-
Microsoft Learn — Migrate MongoDB to Azure Cosmos DB using DMS
-
Microsoft Learn — Choosing between Azure Cosmos DB, Azure DocumentDB, and MongoDB Atlas