Cloud service · Azure · Updated

Azure DocumentDB - Azure DocumentDB is a fully managed, MongoDB-compatible document database service built on the open-source, PostgreSQL-based DocumentDB engine.

In short

Azure DocumentDB runs operational document workloads on dedicated vCore-based clusters, with integrated vector search, flexible indexing, and independent compute and storage scaling. It supports MongoDB drivers and tools while providing Azure-managed infrastructure, security, monitoring, and migration options.

Cloud Services Hub →

9 key features of Azure DocumentDB

01
MongoDB-compatible document operations

Use MongoDB drivers, mongosh, and MongoDB Compass to work with BSON documents, aggregation pipelines, and multi-document ACID transactions. Assess operator and administrative-command compatibility before moving an existing application.

02
Dedicated vCore clusters and online scaling

Size compute and storage independently and shard existing collections online as capacity requirements grow. Storage increases are supported, but shrinking storage on an existing cluster is not.

03
Integrated vector search

Store embeddings alongside operational documents and query them through the MongoDB-compatible API. Paid tiers support DiskANN and HNSW indexes without requiring a separate search cluster.

04
Document indexing and geospatial queries

Use single-field, compound, multikey, text, and geospatial indexes to match application access patterns. Measure the write and storage overhead of indexes rather than indexing every field by default.

05
Advanced full-text search in preview

Public-preview full-text capabilities include BM25 ranking, relevance scores, fuzzy matching, and proximity search. Validate query behavior and preview terms before making these capabilities a production dependency.

06
Managed availability and recovery

Configure optional high availability and use automated backups with point-in-time restore on paid clusters. Backup retention varies by tier, and the free tier does not provide backup or restore.

07
Azure identity and private connectivity

Supported tiers provide Microsoft Entra ID authentication, role-based access control, and private endpoints through Azure Private Link. Fine-grained database- and collection-level access control is in public preview.

08
Migration assessment and tooling

Assess compatibility and migrate selected databases or collections with the Visual Studio Code migration extension or Azure Database Migration Service. Online migration copies existing data and then replicates source changes through change streams until cutover.

09
Azure operational monitoring

Monitor platform metrics through Azure Monitor and send supported diagnostic logs to Log Analytics. Use alerts to identify resource pressure and failures; diagnostic logging is unavailable on the free tier.

Where Azure DocumentDB is used

  1. 01
    MongoDB workload modernization

    Move compatible applications from self-hosted MongoDB, MongoDB Atlas, or Amazon DocumentDB to managed Azure infrastructure. Run compatibility and performance assessments before selecting a migration method and cutover window.

  2. 02
    Retrieval-augmented generation

    Store knowledge documents, metadata, and embeddings together, then retrieve relevant content for an AI model. Apply application authorization filters during retrieval so similarity search does not expose documents across users or tenants.

  3. 03
    Product catalogs and content repositories

    Represent products or content with varying attributes as BSON documents. Use compound indexes for common category, status, and publication-date queries, and evaluate preview full-text capabilities separately from generally available requirements.

  4. 04
    Web and mobile application back ends

    Store user profiles, preferences, application state, and related operational records using familiar MongoDB libraries. Reuse database connections and keep transactions short to accommodate service execution limits.

  5. 05
    Location-aware applications

    Use geospatial indexes and queries for store locators, nearby inventory, or location-based content. Combine location constraints with other indexed attributes and benchmark realistic geographic distributions.

How Azure DocumentDB is priced

Provisioned vCore and storage pricing

Paid clusters are priced by provisioned compute tier and storage rather than request units or per-query consumption. Include high-availability capacity, additional shards, and regional replicas in estimates where configured, and check current regional rates.

Reserved capacity

One-year and three-year reservations provide discounts for eligible committed capacity. Match reservations to a stable usage baseline and confirm eligible configurations and scope before purchasing.

Savings plan for databases

Azure DocumentDB is eligible for the Azure savings plan for databases. Evaluate current commitment terms, eligible usage, and interactions with other discounts against your expected deployment pattern.

Free development tier

One free cluster per Azure subscription provides 32 GB of storage and can be upgraded in place. It excludes high availability, backup and restore, Microsoft Entra ID authentication, diagnostic logging, and DiskANN or HNSW vector indexes; clusters pause after 60 days of inactivity.

Services Azure DocumentDB works with

A common application architecture places an API on Azure Kubernetes Service and connects it to Azure DocumentDB through a private endpoint. The API uses a MongoDB-compatible driver with connection pooling, bounded timeouts, and retry behavior appropriate to each operation. Private DNS must resolve the database hostname correctly from the application network. On supported tiers, Microsoft Entra ID can provide database authentication, with data-access permissions configured separately from Azure resource-management permissions.

For retrieval-augmented generation, an ingestion application sends document text to Azure OpenAI for embedding generation and stores the resulting vectors with document metadata in Azure DocumentDB. At query time, the application embeds the question, performs filtered vector retrieval, and sends selected context to the model. Document authorization, embedding versions, deletion handling, and retry-safe ingestion remain application responsibilities.

Azure Monitor and Log Analytics support operational visibility across these components. Correlate database metrics with application telemetry and use supported diagnostic logs when investigating performance or connection failures. For existing MongoDB estates, Azure Database Migration Service provides a migration path that can copy data and track source changes before cutover. Validate compatibility, connectivity, and recovery procedures before switching production traffic.

Azure OpenAI in Foundry Models

Use Azure OpenAI to generate embeddings and responses while Azure DocumentDB stores source documents, metadata, and vectors. For example, a support assistant can embed an incoming question, retrieve matching knowledge articles, and include authorized excerpts in a model prompt. The application coordinates these calls and must handle embedding-version changes and document updates.

Azure Kubernetes Service (AKS)

Applications running on Azure Kubernetes Service can connect using MongoDB-compatible drivers and private network connectivity. For example, a catalog API can reuse a bounded connection pool across requests while retrieving product documents from a private database endpoint. Configure private DNS resolution and test reconnection behavior during database maintenance or failover.

Azure Monitor

Azure Monitor provides platform metrics, and supported diagnostic logs can be routed to Log Analytics for investigation. For example, correlate rising database CPU and connection counts with an application deployment to diagnose a connection-pool regression. Configure supported diagnostic categories explicitly and account for Log Analytics ingestion and retention costs.

Azure Private Link

Use a private endpoint to provide private access from an application virtual network to Azure DocumentDB. For example, an internal service can resolve the database hostname to a private address instead of using public connectivity. Configure private DNS and public-access settings deliberately; creating a private endpoint alone is not a complete network-isolation policy.

Azure Database Migration Service

Run Azure DocumentDB migration jobs through Azure Database Migration Service without keeping a browser session open. For example, migrate selected MongoDB collections, replicate ongoing changes from a change-stream-enabled source, and cut over after validating data and replication progress. Confirm source prerequisites, network reachability, and compatibility before starting the job.

Azure Blob Storage

Azure DocumentDB diagnostic settings can archive cluster resource logs in Azure Blob Storage. For example, you can retain request logs in a storage account for later review.

Azure Cosmos DB

Azure DocumentDB supports migrating MongoDB workloads from the request-unit-based Azure Cosmos DB for MongoDB service to a dedicated vCore cluster. This is a migration between two separate services, not a change to the throughput setting on the source account.

Azure DNS

Azure DocumentDB private endpoints can use an Azure Private DNS zone to resolve the cluster hostname to its private IP address. Clients in linked virtual networks can then use the normal cluster hostname for private connections.

Azure Key Vault

Azure DocumentDB supports customer-managed keys stored in Azure Key Vault for encryption at rest. The cluster uses a managed identity to access the key.

Azure Policy

Azure DocumentDB cluster settings can be evaluated by Azure Policy. For example, a policy can audit clusters that allow public network access.

Alternatives to Azure DocumentDB in other clouds

AWS

Amazon DocumentDB (with MongoDB compatibility)Amazon DocumentDB (with MongoDB compatibility)

Amazon DocumentDB and Azure DocumentDB are managed document databases that work with MongoDB drivers and tools and let teams scale compute and storage independently. Amazon DocumentDB bills for storage consumed and automatically replicates data across three availability zones, while Azure DocumentDB bills for provisioned storage on paid clusters and makes high availability optional.

Compare fact by fact
Azure DocumentDBAmazon DocumentDB (with MongoDB compatibility)
Storage billingProvisioned storage on paid tiersPer GB-month consumed
High availabilityOptional on paid tiersAutomatic replication across 3 AZs
Free accessOne free dev cluster per subscription30-day trial for new customers

What is Azure DocumentDB

2 min read

Azure DocumentDB is a managed document database for applications that use MongoDB-compatible APIs. It stores BSON documents and supports CRUD operations, aggregation pipelines, indexing, geospatial queries, and multi-document ACID transactions. Its underlying DocumentDB engine is open source, MIT-licensed, and built on PostgreSQL; the managed service does not run the MongoDB server. Applications connect through MongoDB drivers and tools rather than treating the service as a general-purpose PostgreSQL endpoint.

The service was previously named vCore-based Azure Cosmos DB for MongoDB. That rename did not change existing clusters, connection strings, or APIs. It is separate from Azure Cosmos DB for MongoDB with request-unit-based throughput, Amazon DocumentDB, and the original Azure DocumentDB service that became Azure Cosmos DB in 2017. These distinctions matter when selecting SDKs, estimating costs, and interpreting deployment instructions.

Capacity planning uses dedicated cluster tiers and provisioned storage rather than request units. Compute and storage can scale independently, and existing collections can be sharded online. Storage cannot be decreased on an existing cluster. Select a tier using representative query latency, concurrency, memory consumption, and indexing requirements rather than document count alone. Shard-key selection remains important for distributing writes and avoiding expensive cross-shard operations.

MongoDB wire-protocol compatibility allows existing drivers, mongosh, and MongoDB Compass to connect. Compatibility does not mean every MongoDB administrative command or workload behaves identically. Run a compatibility assessment before migration, then test aggregation pipelines, transactions, indexes, and driver behavior under load. Transactions have a maximum lifetime of 30 seconds, so keep transactional work short and avoid waiting on external services inside a transaction.

For AI applications, documents and their embeddings can reside in the same collection. Paid tiers support DiskANN and HNSW vector indexes, allowing applications to retrieve similar documents without maintaining a separate vector database. Generate embeddings in an application or model service, persist their model and version metadata, and keep vector dimensions consistent with the index configuration. Advanced full-text search, including BM25 ranking, fuzzy matching, and proximity search, is in public preview.

Production deployments should explicitly configure availability, networking, authentication, and observability. The service supports optional high availability, private endpoints, Microsoft Entra ID authentication, and Azure Monitor integration. Database- and collection-scoped fine-grained role-based access control is in public preview. Validate regional and tier availability before depending on a capability, and test client reconnection and recovery procedures.

Paid clusters include automated backups and point-in-time restore, with retention depending on the tier. The free tier is useful for development but excludes high availability, backup and restore, Microsoft Entra ID authentication, advanced vector indexes, and diagnostic logging. For migration, use Azure Database Migration Service, the migration extension for Visual Studio Code, or native MongoDB export and restore tools. Online migration requires source change streams and a planned final cutover.

Azure architecture icons are the property of Microsoft. BlowStack is not affiliated with or endorsed by Microsoft.

AWS architecture icons are the property of Amazon Web Services. BlowStack is not affiliated with or endorsed by AWS.