Atlas 1,815 is not the only place to put a MongoDB-shaped database, and the difference reaches your code: some run the actual server, and some only reimplement its wire protocol.
| Option | What it runs | Watch out for |
|---|---|---|
| Atlas | MongoDB 1,815 , current versions | lock-in for Search, Triggers |
| AWS 24 DocumentDB 24 | reimplementation | API gaps, no stream parity |
| Azure Cosmos DB 6 | reimplementation | request-unit billing |
| Percona Server 1,275 | Community fork, AGPL v3 | you operate it |
| Kubernetes 5,150 Operator | MongoDB, in your cluster | Kubernetes expertise |
| FerretDB 11,082 | Mongo protocol on Postgres 1,289 | subset of operators |
The reimplementations deserve care. Amazon DocumentDB and Azure Cosmos DB's Mongo API both speak the wire protocol, so the driver connects and simple CRUD works, but neither is MongoDB: aggregation stages, index types, change stream events and collation all differ, and the gaps move between versions. Test the queries you run.
FerretDB (https://github.com/FerretDB/FerretDB 11,082 ) is the open-source case worth knowing: Apache 2.0, about 11,000 GitHub 29 stars, translating MongoDB commands into PostgreSQL with the DocumentDB extension underneath. You get a genuinely open license and one engine to operate instead of two, at the cost of a smaller operator set. Percona Server for MongoDB 251 (https://github.com/percona/percona-server-mongodb 251 ) is a drop-in build of the Community source under AGPL v3, with auditing, LDAP and hot backups added. Self-hosting on a VPS is cheapest and costs the most attention: replica set, backups, certificates and monitoring are all yours (Operating a MongoDB Deployment).
Whatever you choose, keep the connection string in one environment variable and never branch on the provider in application code: swapping Atlas for a container in CI is then a configuration change.