On this page
Short answer
Short answer
If your application is mostly simple reads and writes of documents with a few joins, PostgreSQL JSONB is the cleanest exit: one engine, full transactions, a licence with no service clause, and a rewrite of the data access layer. If you cannot touch the application code, FerretDB or the open-source DocumentDB project put a MongoDB wire-protocol layer on PostgreSQL, and Amazon DocumentDB offers a managed MongoDB-compatible API, but each documents features it does not support, so the test is your own query and transaction list, not a compatibility percentage. If your estate depends on aggregation pipelines, change streams or sharded clusters, staying on MongoDB is a legitimate answer. The SSPL's service clause is about offering MongoDB's functionality to others as a service, so check whether it applies to you before treating it as a reason to leave. AceMQ supports MongoDB and PostgreSQL, so it can recommend any of these without a stake in the answer.
MongoDB and four alternatives on the same criteria (checked 4 November 2026 against vendor and project documentation; the last row is AceMQ's own description of its services)
| MongoDB (baseline) | PostgreSQL JSONB | FerretDB | DocumentDB (open source and Azure) | Amazon DocumentDB | |
|---|---|---|---|---|---|
| What it is | The document database from MongoDB, Inc., self-managed or in Atlas. | PostgreSQL storing documents in a binary jsonb column next to ordinary tables. | A proxy that converts MongoDB wire-protocol queries to SQL, using PostgreSQL with the DocumentDB extension as its engine. | A MongoDB-compatible document database built on PostgreSQL, with a managed form in Azure DocumentDB. | An AWS-managed service with a MongoDB-compatible API. It is not MongoDB. |
| Licence | SSPL v1, dated 16 October 2018. | PostgreSQL licence. | Apache-2.0. | MIT. Microsoft states the SSPL does not apply to DocumentDB or Azure DocumentDB. | Proprietary, AWS service terms. |
| How closely it matches MongoDB | It is MongoDB. Current release 9.0. | No wire protocol. You rewrite data access to SQL and jsonpath. | Documents itself as a drop-in replacement for MongoDB 5.0+ in many cases, with a published list of known differences. | Microsoft cites 99.03% MongoDB compatibility for Azure DocumentDB. That is Microsoft's own figure, not a test of your workload. | Offers 4.0, 5.0 and 8.0 API versions. AWS says it does not support every MongoDB feature and publishes the differences. |
| Transactions | Multi-document transactions on replica sets and sharded clusters. | Full ACID transactions across tables and documents. | FerretDB's 2.7 documentation lists commitTransaction and abortTransaction as unsupported. | Test against your transaction usage and check the current compatibility documentation. | ACID transactions since 4.0, per AWS documentation. |
| Aggregation pipelines | Native, including $lookup, $facet and $merge. | Rewritten as SQL with jsonb functions and jsonpath. Often shorter, sometimes slower. | Supports aggregate, count and distinct; test each stage you use. | Test each stage you use. | A supported subset that varies by version. 8.0 adds stages such as $merge and $vectorSearch. |
| Change streams | Native. | Logical decoding and CDC tools such as Debezium, with a different event shape. | Not listed in the compatibility pages we checked. Test before relying on them. | Test before relying on them. | Supported, with retention extendable to 7 days per AWS documentation. |
| Best for | Document-first applications that use pipelines, change streams or sharding heavily. | Simple document CRUD with some relational queries, on a team that already runs PostgreSQL. | Keeping MongoDB drivers and queries while moving storage to PostgreSQL. | Teams that want an open, MongoDB-compatible engine on PostgreSQL, on-premises or in Azure. | AWS-only estates that want a managed service and accept its subset. |
| AceMQ cover | Tier 1 and 2 support; Tier 3 and 4 quoted per engagement. | Tier 1 and 2 PostgreSQL support, consulting and migration planning; Tier 3 and 4 quoted. | AceMQ supports the PostgreSQL layer. FerretDB itself is scoped per engagement. | AceMQ supports the PostgreSQL layer. Microsoft runs Azure DocumentDB. | AWS operates the service. AceMQ's work is the assessment, the migration plan and the application side. |
Three moves, not one
Stay. Keep MongoDB, and change how you run it: self-managed with independent support, Atlas, or a different hosting arrangement. The SSPL only changes what you may do if you offer MongoDB's functionality to third parties as a service, so it may not apply to you, which counsel can confirm.
Proxy. Keep the MongoDB drivers and queries and change the engine underneath. FerretDB and DocumentDB both translate the MongoDB wire protocol to PostgreSQL, and Amazon DocumentDB and Azure Cosmos DB for MongoDB are cloud services with a MongoDB-compatible API. You save a rewrite and accept a feature subset. Microsoft's documentation now points teams migrating an existing MongoDB application, or using MongoDB query language features, to Azure DocumentDB rather than Cosmos DB for MongoDB.
Leave. Move to PostgreSQL JSONB, or to a different model such as Cassandra for write-heavy, key-based access. You rewrite the data layer and get a normal relational engine, or a different data model, in return.
What actually breaks
Compatibility percentages hide the features that decide a migration. These are the ones to list before choosing.
- Aggregation pipelines. A pipeline with $lookup, $facet or $graphLookup has no one-line SQL equivalent. Inventory the stages in use, with the collections and the traffic they carry.
- Transactions. MongoDB supports multi-document transactions from 4.0 on replica sets. If your code relies on them, FerretDB's documented gap is a blocker, not a detail.
- Change streams. Anything that listens to a collection, such as cache invalidation or an event feed, needs a replacement. On PostgreSQL that is logical decoding or a CDC tool.
- Types. BSON has ObjectId, Decimal128 and date types. JSONB stores JSON, so those become strings, numbers or columns by a rule you decide up front.
- Document size and updates. PostgreSQL documentation warns that updating a jsonb value locks the whole row, so keep documents a manageable size and move hot fields into columns.
- Sharding. A sharded MongoDB cluster has no single-node equivalent in PostgreSQL. Size the data before assuming one server holds it.
PostgreSQL JSONB: the cleanest exit for simple documents
PostgreSQL stores jsonb as a decomposed binary format, indexes it with GIN, and queries it with operators and jsonpath. Its documentation recommends jsonb for most applications, and notes that it does not keep key order or duplicate keys, and that numbers follow the numeric type. The practical design is hybrid: columns for the identifiers, foreign keys and fields you filter on, and a jsonb column for the variable remainder. That gives one engine to run, back up and secure, and joins that MongoDB would do with $lookup.
The rewrite is real. Every query, index, validation rule and migration script in the application changes. For a team with a small number of collections, that is a project; for hundreds of collections with deeply nested documents, it is a program, and the proxy options become more attractive.
FerretDB and DocumentDB: keep the drivers, change the engine
FerretDB is Apache-2.0 and, per its repository, converts MongoDB 5.0+ wire protocol queries to SQL on PostgreSQL with the DocumentDB extension. Its migration route uses mongodump and mongorestore, and its documentation lists the commands it does not support, including transaction commands and role management. DocumentDB, the project that provides that extension, is MIT licensed and described by Microsoft as Linux Foundation governed, and Azure DocumentDB is the managed form. Both put your documents in PostgreSQL, which is attractive if PostgreSQL is already your standard.
The caution is the same for both: they are younger than MongoDB, they implement a subset, and "drop-in in many cases" means you have to find out whether your case is one of them. Run the application's real test suite against a copy before committing, and check the projects' current release notes, because both are moving.
Amazon DocumentDB and Cosmos DB for MongoDB: managed, with a subset
Amazon DocumentDB is an AWS service that offers MongoDB 4.0, 5.0 and 8.0 compatibility. AWS documentation says it does not support every MongoDB feature and lists the functional differences, so read the supported-operations page for your version before planning. AWS Database Migration Service can use MongoDB as a source, in document mode (a single _doc column) or table mode (fields flattened to columns), with limits such as consistent field types in table mode and an oplog sized for the copy. It suits an AWS-only estate that wants the operations handled and accepts the subset.
Azure Cosmos DB for MongoDB is another Microsoft MongoDB-compatible service. Microsoft's own overview now suggests Azure DocumentDB for applications that must migrate existing MongoDB workloads or use MongoDB query language features. Neither service is MongoDB, and neither is operated by AceMQ.
The SSPL question
MongoDB released the Server Side Public License v1 on 16 October 2018. Section 13 says that if you make the functionality of the program available to third parties as a service, you must release the Service Source Code, which MongoDB's text defines to include management, monitoring, backup and hosting software. The Open Source Initiative has said the SSPL is not an open source licence. The service clause is aimed at vendors that sell MongoDB as a service, so whether it affects a company that runs MongoDB only for its own applications is a question for counsel. MongoDB's page does not state which server versions carry the SSPL, so confirm that for the release you run. Read this as a summary, not legal advice.
Who should stay on MongoDB
- You use pipelines, change streams or sharding heavily. These are the features alternatives replicate least well.
- Your documents are the product. Deeply nested, schema-variable data is what MongoDB is for, and flattening it costs more than it saves.
- The driver is the Atlas bill. Review cluster tier, storage and data transfer first. Our MongoDB Atlas pricing article lists the dimensions that move the price.
- The driver is the licence and you are not a service vendor. Ask counsel whether the SSPL's service clause applies to you before spending a migration budget.
Staying still leaves a choice of support. MongoDB publishes lifecycle dates for each release line, and the earliest of the current lines ends on 31 August 2027 (7.0, Enterprise Advanced table), so plan upgrades whichever way you go.
Other directions
Apache Cassandra (Apache-2.0) suits write-heavy workloads with key-based access across regions, but it is a wide-column model with its own query language, so it is a redesign, not a MongoDB replacement. Couchbase is another document database with its own query language; check its current licence terms before shortlisting it. MariaDB and MySQL have JSON columns, with relational-first design and fewer document features than PostgreSQL's jsonb. Amazon DynamoDB and Apache CouchDB come up in every list: DynamoDB is an AWS-only key-value and document service where you design the table around your access patterns first, and CouchDB is a document store built around replication. AceMQ supports Cassandra, MySQL and PostgreSQL; it does not support Couchbase, DynamoDB or CouchDB.
Where AceMQ is not the right fit
AceMQ is independent. It is not a MongoDB, Percona, FerretDB, AWS or Microsoft partner, and it cannot provide their support entitlements or licences. It does not rewrite application code, which stays with your developers or a modernization partner, and it does not operate Amazon DocumentDB or Azure services. AceMQ assesses the estate, recommends stay, proxy or leave with the reasoning, plans and runs the parallel migration with your engineers, and supports or operates the PostgreSQL or MongoDB result at Tier 1 to Tier 4.
How we compared
We compared MongoDB and four alternatives on eight criteria: what it is, licence, how closely it matches MongoDB, transactions, aggregation pipelines, change streams, best fit and AceMQ cover. We did not benchmark or run migrations for this page, and compatibility statements are the vendors' own, attributed as such. Versions and documentation change, so confirm them for the release you plan to use.
Sources, all checked on 4 November 2026: MongoDB's SSPL page and lifecycle schedule; the Open Source Initiative's statement on the SSPL; the PostgreSQL JSON documentation; the FerretDB and DocumentDB repositories and the FerretDB migration documentation; Microsoft's Azure DocumentDB and Cosmos DB for MongoDB overviews; and AWS documentation for Amazon DocumentDB compatibility and MongoDB as a DMS source.
Frequently asked questions
What is the best alternative to MongoDB?
It depends on how much of the application you can change. PostgreSQL JSONB is the cleanest exit for simple document workloads. FerretDB, DocumentDB and Amazon DocumentDB keep the MongoDB drivers but implement a subset of the features. For pipeline-heavy or change-stream-heavy applications, staying on MongoDB is often the right answer.
Is MongoDB still open source?
MongoDB licenses its server under the Server Side Public License v1, released on 16 October 2018, and the Open Source Initiative has said the SSPL is not an open source licence. The service clause concerns offering MongoDB's functionality to others as a service, so ask counsel whether it applies to you. This is not legal advice.
Is FerretDB a drop-in replacement for MongoDB?
Its repository describes it as a drop-in replacement for MongoDB 5.0+ in many cases, and its documentation lists known differences and unsupported commands, including transaction commands. Whether your application is one of the many cases is something to test with its own test suite.
Can PostgreSQL replace MongoDB?
Often, yes, for applications that mostly read and write documents with some joins. PostgreSQL stores jsonb with GIN indexes and jsonpath queries and gives you full transactions. The cost is a rewrite of the data access layer, aggregation pipelines and anything that listens to change streams.
Who supports MongoDB and PostgreSQL under one contract?
AceMQ supports both with 24/7 cover and response targets from 15 minutes, by plan, for Severity 1 incidents, from reactive support through to managed operations on your infrastructure or AceMQ's. Because AceMQ supports both engines and is independent of MongoDB, the recommendation does not depend on which one it sells.