# MongoDB alternatives: DocumentDB, FerretDB and the managed services worth comparing

> The MongoDB alternatives people actually compare, starting with open-source DocumentDB and FerretDB, then Atlas itself, Azure, Amazon DocumentDB, Firestore, Couchbase and plain PostgreSQL JSONB. What each one is, what it costs to start, and what it asks you to change.

Published: 2026-11-02
Canonical: https://layerbase.com/blog/mongodb-alternatives

Short version: if you want to keep your MongoDB driver and your queries, the two open-source options are **DocumentDB** (MIT, a PostgreSQL-based engine with its own MongoDB-compatible gateway) and **FerretDB** (Apache 2.0, a MongoDB protocol layer over the same PostgreSQL extension). Layerbase hosts both, and DocumentDB is on our [Free plan](/blog/documentdb-free-plan). If you want to stay inside one cloud, Azure, AWS and Google each sell a MongoDB-compatible service. If you are willing to rewrite your data access code, Couchbase and PostgreSQL JSONB are the serious options. And if you depend on Atlas Search, change streams or a replica set today, Atlas itself may still be the right answer.

Vendor facts below were checked against each vendor's own docs and pricing pages in early November 2026. Prices change, so follow the links before you plan a budget around any of them.

## Contents

- [First: three different things called DocumentDB](#first-three-different-things-called-documentdb)
- [Why people look for an alternative](#why-people-look-for-an-alternative)
- [The baseline: MongoDB Atlas](#the-baseline-mongodb-atlas)
- [1. DocumentDB (open source)](#1-documentdb-open-source)
- [2. FerretDB](#2-ferretdb)
- [3. Azure DocumentDB and Azure Cosmos DB for MongoDB](#3-azure-documentdb-and-azure-cosmos-db-for-mongodb)
- [4. Amazon DocumentDB](#4-amazon-documentdb)
- [5. Firestore with MongoDB compatibility](#5-firestore-with-mongodb-compatibility)
- [6. Couchbase](#6-couchbase)
- [7. PostgreSQL with JSONB](#7-postgresql-with-jsonb)
- [Side by side](#side-by-side)
- [FAQ](#faq)

## First: three different things called DocumentDB

This trips up almost everyone, so it goes first.

| Name | What it is | Who runs it |
|---|---|---|
| **DocumentDB** (open source) | An MIT-licensed document database built on PostgreSQL, with its own MongoDB-compatible gateway. Started at Microsoft, now a Linux Foundation project | Anyone. Source on [GitHub](https://github.com/documentdb/documentdb). Layerbase hosts it |
| **Azure DocumentDB** | Microsoft's managed service built on the open-source project. It was called vCore-based Azure Cosmos DB for MongoDB until November 2025 | Microsoft, on Azure only |
| **Amazon DocumentDB** | A proprietary AWS database service "with MongoDB compatibility". Not related to the open-source project beyond the name | AWS, on AWS only |

When this post says DocumentDB without a qualifier, it means the open-source project. Microsoft announced the Azure rename in its [general availability post](https://devblogs.microsoft.com/cosmosdb/azure-documentdb-is-now-generally-available/) on November 18, 2025.

## Why people look for an alternative

Two reasons come up more than any other.

**The license.** MongoDB Community Server releases from October 16, 2018 onward are under the Server Side Public License. MongoDB's [SSPL FAQ](https://www.mongodb.com/legal/licensing/server-side-public-license/faq) explains that if you offer MongoDB to third parties as a service, you must release the source of everything you use to run that service, including management, monitoring, backup and hosting software. Using MongoDB as the database behind your own SaaS app is not covered by that clause, and MongoDB says so. But many legal teams treat SSPL as not open source, and no independent cloud host can offer the MongoDB server itself. That is why Layerbase hosts DocumentDB and FerretDB instead of MongoDB.

**The bill.** Atlas pricing is per cluster tier per hour, with storage, backups and data transfer on top. For small and medium workloads, that can add up to more than the working set justifies.

## The baseline: MongoDB Atlas

Atlas is the reference point, and it is good at what it does. From [mongodb.com/pricing](https://www.mongodb.com/pricing):

- **Free (M0):** 512 MB of storage on shared resources.
- **Flex:** from $0.011/hour, which MongoDB says works out to between $8 and $30 a month depending on throughput, with 5 GB of storage.
- **Dedicated:** M10 at $0.08/hour (2 GB RAM), M20 at $0.20/hour (4 GB), M30 at $0.54/hour (8 GB). These are base prices; MongoDB notes that real cost varies by configuration and region.

What you get that the alternatives below mostly do not: the real MongoDB server, so full feature coverage, plus Atlas Search, change streams, replica sets by default and multi-region clusters. If your app depends on those, read this list as a reference for later and stay put. Our [Atlas alternatives post](/blog/mongodb-atlas-alternative) goes deeper on the price comparison and on when to stay.

## 1. DocumentDB (open source)

DocumentDB stores BSON documents in PostgreSQL and exposes a MongoDB-compatible gateway, so `mongosh` and the official drivers connect with a normal `mongodb://` connection string. It reached [version 1.0](https://documentdb.io/blogs/posts/documentdb-1-0/) on October 19, 2026. The license is MIT, which is about as unrestrictive as licenses get.

On Layerbase it is a standalone engine: DocumentDB 1.0 with its own gateway, separate from FerretDB. You can create one on the Free plan (2 databases, 5 GB, no card), and it sleeps when idle and wakes on the next connection. Before moving it to Free we measured its memory against PostgreSQL; the [announcement post](/blog/documentdb-free-plan) has the numbers. Solo is $5/month and Pro is $15/month if you want databases that stay on. Branches work on DocumentDB too, so you can give a preview deploy or an agent its own copy of the data.

What to check before you move: compatibility is not identical to MongoDB. Test your queries, indexes, aggregation pipelines and authentication setup in a disposable database. Our guided Atlas import currently loads into FerretDB, not DocumentDB, so a DocumentDB move today is your own export and import.

In our [October 23 YCSB run](/benchmarks/2026-10-23-ferretdb-documentdb) on matched 4 vCPU / 8 GB instances, DocumentDB had more throughput than FerretDB in every workload row, and FerretDB had lower update p99 latency in every 50/50 row. It was one run per stack, so treat it as a starting point.

[DocumentDB on Layerbase](/db/documentdb)

## 2. FerretDB

FerretDB is an Apache 2.0 project that implements the MongoDB wire protocol in front of PostgreSQL. Its 2.x versions use the DocumentDB PostgreSQL extension for storage, so the two projects share a foundation but are different products with different protocol layers.

It has been around longer, and that shows in the tooling. On Layerbase, FerretDB has the [guided Atlas migration](/migrate/mongodb-atlas): paste a `mongodb+srv://` string and it copies collections, documents and indexes, then checks the counts against the source. FerretDB starts on Solo. The known gaps worth checking first are text indexes and `$text`, change streams and `$lookup`; the [MongoDB vs FerretDB comparison](/blog/mongodb-vs-ferretdb) lists them all.

MongoDB filed a [lawsuit against FerretDB](https://dockets.justia.com/docket/delaware/dedce/1:2025cv00641/89247) in May 2025. I am not going to guess at the outcome. It is one reason some teams have asked us for a second option, and part of why we added DocumentDB.

[FerretDB on Layerbase](/db/ferretdb)

## 3. Azure DocumentDB and Azure Cosmos DB for MongoDB

Microsoft sells two different MongoDB-compatible services, which is confusing on its own.

**Azure DocumentDB** is the managed version of the open-source DocumentDB project, so it is the closest relative of what we run. Its [free tier](https://learn.microsoft.com/en-us/azure/documentdb/free-tier) gives one cluster per Azure subscription with 32 GB of storage, in a limited set of regions. The free tier leaves out high availability, backup and restore, and some vector index types, and a free cluster is paused after 60 days of inactivity.

**Azure Cosmos DB for MongoDB** is the request-unit (RU) based API on Cosmos DB, a separate service with its own engine. The Cosmos DB [lifetime free tier](https://learn.microsoft.com/en-us/azure/cosmos-db/free-tier) covers the first 1,000 RU/s and 25 GB of storage on one account per subscription. Throughput past that bills at the normal rate, which makes cost depend on how many request units your queries burn.

Either one makes sense if your company already runs on Azure and wants the database inside the same network and the same bill.

## 4. Amazon DocumentDB

Amazon DocumentDB is AWS's own database "with MongoDB compatibility". AWS [describes it](https://docs.aws.amazon.com/documentdb/latest/developerguide/what-is.html) as letting you use the same drivers and tools you use with MongoDB. It is not open source and runs only on AWS, inside an Amazon VPC. Storage is separated from compute and replicated six ways across three availability zones, and you can add up to 15 read replicas.

From the [pricing page](https://aws.amazon.com/documentdb/pricing/): new users get a one-month free trial with 750 hours of a db.t3.medium instance, 5 GB of storage and 5 GB of backup storage. After that you pay for instance hours, I/O, backup storage and data transfer. A db.r5.large lists at $0.277/hour in US East (N. Virginia) on standard storage, and the serverless option starts at 0.5 DCU at $0.0822 per DCU-hour in the same region.

It fits teams that are already deep in AWS and want replicas and point-in-time recovery managed for them. The VPC-only design means connecting from outside AWS, such as from a laptop or a different cloud, takes extra networking work.

## 5. Firestore with MongoDB compatibility

Google added a MongoDB-compatible API to Firestore, which went [generally available](https://firebase.blog/posts/2025/08/firestore-mongodb-general-availability) on August 26, 2025. It is part of Firestore Enterprise edition, serverless and pay-per-use, and Google's [overview](https://docs.cloud.google.com/firestore/mongodb-compatibility/docs/overview) pitches it as a way to run existing MongoDB applications on Firestore. It is the natural pick if you are already on Firebase or Google Cloud. The underlying database is Firestore, so check the feature list against your app the same way you would for any of the compatible options here.

## 6. Couchbase

Couchbase is a different kind of alternative. It is a document database, but it does not present itself as MongoDB: you use its own SDKs and its SQL++ query language. Moving from MongoDB means rewriting the data access layer, not changing a connection string. In exchange you get key-value access, full-text and vector search, and a mobile sync story that MongoDB does not have in the same shape.

Licensing is worth reading. Couchbase Server is under the Business Source License 1.1; the [license file](https://github.com/couchbase/kv_engine/blob/master/licenses/BSL-Couchbase.txt) for Server 8.0 forbids offering it as a commercial hosted service and converts to Apache 2.0 on March 1, 2029. Couchbase's managed service, Capella, has a free tier with a single node and paid Basic clusters from $0.15/hour per node, per its [pricing page](https://www.couchbase.com/pricing/).

## 7. PostgreSQL with JSONB

The least glamorous option is often the right one. PostgreSQL's `jsonb` type stores JSON in a binary format, and the [PostgreSQL docs](https://www.postgresql.org/docs/current/datatype-json.html) describe GIN indexes that search for keys or key/value pairs across large numbers of documents. You keep documents for the parts of your data that are genuinely shaped like documents, and you get joins, transactions and constraints for the rest.

The cost is a rewrite: your queries become SQL, and your driver becomes a Postgres driver. If you were going to restructure the app anyway, or most of your data was relational all along, it is worth it.

PostgreSQL is on the Layerbase Free plan as well. [PostgreSQL on Layerbase](/db/postgresql)

## Side by side

| Option | Keeps your MongoDB driver | License | Free option (as of November 2026) |
|---|---|---|---|
| DocumentDB (open source) | Yes, test compatibility | MIT | Layerbase Free plan, 2 databases, 5 GB |
| FerretDB | Yes, test compatibility | Apache 2.0 | Self-host; on Layerbase from Solo |
| MongoDB Atlas | Yes, it is MongoDB | SSPL server | M0, 512 MB |
| Azure DocumentDB | Yes, test compatibility | Managed service (built on MIT project) | One free cluster per subscription, 32 GB |
| Azure Cosmos DB for MongoDB (RU) | Yes, test compatibility | Proprietary | 1,000 RU/s and 25 GB per subscription |
| Amazon DocumentDB | Yes, test compatibility | Proprietary | One-month trial |
| Firestore with MongoDB compatibility | Yes, test compatibility | Proprietary | See Google's Firestore pricing |
| Couchbase | No, own SDKs and SQL++ | BSL 1.1 server | Capella free tier, one node |
| PostgreSQL JSONB | No, SQL | PostgreSQL License | Layerbase Free plan, and many others |

If I were starting a new project that wanted the MongoDB API without SSPL, I would try DocumentDB first, keep FerretDB in mind for the guided Atlas import and its longer track record, and only reach for a cloud vendor's service if the rest of the stack already lives in that cloud.

## FAQ

### What is the best MongoDB alternative?

It depends on what you want to keep. To keep your driver and queries with an open-source license, look at DocumentDB or FerretDB. To stay inside Azure, AWS or Google Cloud, use that cloud's MongoDB-compatible service. If you can rewrite your data access, PostgreSQL JSONB or Couchbase. If you need Atlas Search, change streams or a replica set today, MongoDB Atlas.

### Is Amazon DocumentDB the same as open-source DocumentDB?

No. Amazon DocumentDB is a proprietary AWS service. The open-source DocumentDB is an MIT-licensed project that started at Microsoft and is now governed by the Linux Foundation. Azure DocumentDB is Microsoft's managed version of the open-source project. Layerbase runs the open-source project.

### Is there a free MongoDB-compatible database?

Several. Layerbase hosts DocumentDB on its Free plan (2 databases, 5 GB, no card). MongoDB Atlas has a 512 MB M0 cluster, Azure DocumentDB has a free cluster with 32 GB, and the Cosmos DB free tier covers 1,000 RU/s and 25 GB. Amazon DocumentDB offers a one-month trial rather than a lasting free tier.

### Why can't Layerbase host MongoDB itself?

MongoDB's server is under the SSPL, which requires anyone offering it as a service to release the source of their whole service stack. We host DocumentDB and FerretDB instead, which speak the MongoDB wire protocol under MIT and Apache 2.0 licenses.

### Will my MongoDB code work on DocumentDB or FerretDB?

The ordinary path usually does: connecting, `find`, `insertOne`, updates and common aggregation stages. Neither is the MongoDB server, so test the specific features you rely on in a disposable database before moving production data.

### How do I move from Atlas?

To FerretDB, use the [guided Atlas migration](/migrate/mongodb-atlas). To DocumentDB, use your own export and import for now, and check documents, indexes and queries in a test database before cutover.

## Starting

[Create a DocumentDB database for free](https://cloud.layerbase.com/create), or compare the two engines on the [MongoDB-compatible engine page](/db/mongodb) first. Plan details are on the [pricing page](/pricing).
