The License That Turned MongoDB Into a Liability
Here’s the thing about MongoDB Community in 2026: if you’re self-hosting it, you need to understand the SSPL — the Server Side Public License — or you might wake up one day with a very expensive legal problem.
MongoDB didn’t switch to SSPL to be friendly. They did it because cloud vendors were running MongoDB as a service without contributing anything back, and the company wanted a piece of that pie. Fair? Maybe. Enforceable? Debatable. Your problem? Absolutely.
The short version: SSPL says that if you use MongoDB to provide a service to others (and yes, internal tooling might count), you have to open-source the infrastructure that runs it. Not just your app — the actual infrastructure. The networking layer, the monitoring stack, the deployment automation. All of it.
If you’re a solo hobbiest running Mongo for a personal project, you’re probably fine. If you’re running it in any kind of company environment, even a private one, you’re in a gray zone that nobody wants to inhabit.
So what do you do? Either you go full MongoDB Atlas (cloud-hosted, no self-hosting problems), you pick a different database entirely, or you get creative. Enter FerretDB.
FerretDB: The MongoDB API Without the Legal Migraine
FerretDB is a proxy that speaks fluent MongoDB but runs on Postgres, MySQL, or SQLite under the hood. It’s like wearing a MongoDB costume while driving a Postgres engine. The good news? You get the MongoDB API your app already knows, the bad news? It’s not a perfect substitute.
What FerretDB Actually Is
FerretDB intercepts MongoDB protocol traffic and translates it into SQL queries against a real relational database. Your app uses the MongoDB driver (pymongo, node-mongo, go-mongo, whatever), but instead of talking to MongoDB, it’s talking to FerretDB, which then talks to Postgres.
It’s compatible enough for most use cases. Aggregation pipelines? Sure. Transactions? Yep. Indexes? Obviously. Full-text search, geospatial queries? They’re getting there, but they’re not perfect yet.
What’s the catch? Performance. FerretDB is doing translation work that native MongoDB doesn’t have to do. It’s not slow — more like “you’ll notice it when you’re doing millions of writes per minute.” For typical self-hosted workloads? Honest answer: you probably won’t care.
Running FerretDB in Docker Compose
Here’s the play:
version: '3.8'services: postgres: image: postgres:17-alpine environment: POSTGRES_USER: ferretdb_user POSTGRES_PASSWORD: strongpasswordhere POSTGRES_DB: ferretdb volumes: - postgres_data:/var/lib/postgresql/data ports: - "5432:5432" healthcheck: test: ["CMD-SHELL", "pg_isready -U ferretdb_user -d ferretdb"] interval: 5s timeout: 5s retries: 5
ferretdb: image: ghcr.io/ferretdb/ferretdb:latest environment: FERRETDB_POSTGRESQL_URL: "postgres://ferretdb_user:strongpasswordhere@postgres:5432/ferretdb" FERRETDB_HANDLER: postgresql ports: - "27017:27017" depends_on: postgres: condition: service_healthy
volumes: postgres_data:Spin it up with docker compose up -d and you’ve got a MongoDB-compatible service running on localhost:27017. Your app connects exactly like it would to real MongoDB — same driver, same connection string format (mongodb://localhost:27017), same API calls.
The magic is that FerretDB translates the MongoDB wire protocol into Postgres queries. It’s all happening behind the scenes.
Real MongoDB vs FerretDB: When Self-Hosting Still Makes Sense
Okay, so when do you actually want to run MongoDB (the real one) on your own servers in 2026?
Use real, self-hosted MongoDB if:
- You’re absolutely certain about the SSPL implications (consult a lawyer, seriously)
- You have a legal team that says it’s fine
- You’re in a jurisdiction where SSPL is clearer (it’s not clear anywhere, but some places are less murky)
- You need raw performance that FerretDB can’t match
- You’re running a truly isolated internal tool with no exposure to “service provision” interpretations
Use FerretDB if:
- You want MongoDB semantics without the license nightmare
- You’re comfortable with Postgres as the underlying store
- Your app’s performance requirements are “typical” (not “millions of ops/sec”)
- You want to sleep at night
Use Atlas (cloud) if:
- You just want MongoDB without thinking about any of this
- Your budget allows for it
- You want someone else to manage backups, replication, security
The FerretDB Compatibility Reality Check
Here’s where FerretDB gets honest: it’s not 100% MongoDB. It’s like 85-95% depending on what you’re doing.
What works great:
- Basic CRUD operations (find, insert, update, delete)
- Most aggregation pipeline stages
- Indexes (single-field and compound)
- Transactions (within a single FerretDB instance)
- Replication (via Postgres replication)
- TTL indexes (via background cleanup)
What’s shaky or missing:
- Change streams (not fully implemented)
- Some aggregation operators (less common ones)
- Sharding (not supported — you get replication, not sharding)
- Full-text search (basic support, not at MongoDB’s level)
- Certain data types and their behavior edge cases
The practical question: does your app hit those edge cases? Probably not. If you’re using basic to intermediate MongoDB features, FerretDB will work fine.
Testing Before You Commit
Before you rip out MongoDB and replace it with FerretDB, test it:
# Spin up the Compose stackdocker compose up -d
# Run your integration tests against FerretDBexport MONGO_URL=mongodb://localhost:27017/testdbnpm test # or pytest, go test, whatever
# If tests pass, you're goldenIf your tests hit unsupported features, you’ll know immediately. If they pass, you’ve got solid evidence that FerretDB will work for your app.
Migration Path: MongoDB → FerretDB
If you’re running MongoDB today and want to switch to FerretDB:
- Dump your MongoDB data (using
mongodump) - Stand up FerretDB with your new Postgres backend
- Restore the data using
mongorestoreagainst the FerretDB endpoint - Swap your connection string in your app config
- Run your tests (this is where problems show up)
- Gradual cutover: send a percentage of traffic to FerretDB, monitor, ramp up
# Export from MongoDBmongodump --uri="mongodb://mongo-host:27017" --out=./dump
# Start FerretDB stackcd ferretdb-compose && docker compose up -d
# Import into FerretDBmongorestore --uri="mongodb://localhost:27017" ./dumpThe whole thing takes maybe an hour. If something breaks during the test phase, you roll back. It’s low-risk.
The Postgres Elephant in the Room
Here’s a thought: if you’re running FerretDB, you’re really running Postgres. So why not just use Postgres directly?
Fair question. The answer is: you don’t have to rewrite your app. Your Python code that uses pymongo? It works unchanged. Your Node.js Mongoose schemas? No changes. Your Go mongo-go-driver code? Unchanged.
That’s the value prop. You get to keep your codebase while ditching the legal liability.
But if you’re starting fresh, yeah, using Postgres directly and building your app around it would probably be simpler. You’d get better performance and no compatibility mystery. The time you save reimplementing your data layer might be worth more than the time you save from not learning Postgres.
PostgreSQL: The Alternative You Should Consider
Real talk: Postgres is phenomenal. It’s been out for 30 years, it’s battle-tested, and it’s open source in the way that actually matters (not “open source for non-cloud providers”).
If you’re picking a database for a new self-hosted project in 2026, Postgres should be your first instinct. It handles JSON first-class (JSONB), it has great driver support, and the entire ecosystem of DevOps tooling assumes you’re using Postgres anyway.
The only reason to pick MongoDB-shaped databases (real Mongo or FerretDB) is if you’re committed to document-oriented modeling or you’re migrating existing code.
Decision Tree: Which Do I Pick?
Here’s your flow:
Existing MongoDB app? → FerretDB (cheapest migration, immediate risk reduction)
Building new, needs document DB? → Consider Postgres + JSONB (better long-term)
Absolutely need MongoDB? → Atlas cloud (no self-hosting, no SSPL nightmare)
Enterprise customer? Lots of data? → Atlas or hire someone to navigate the SSPL (hint: it’s expensive)
Solo project, don’t care about licensing? → MongoDB Community (your risk, not ours)
The Bottom Line
SSPL isn’t evil, but it’s not developer-friendly either. It exists to solve MongoDB’s problem, not yours.
If you’re self-hosting databases and want a MongoDB-shaped API, FerretDB + Postgres is a genuinely solid option in 2026. It’s stable, it’s compatible, and it’s licensed under Apache 2.0 (which is fine for self-hosted use).
If you’re not married to the document model, Postgres alone will serve you better and faster. But if you’re keeping existing MongoDB code, FerretDB is the path of least friction.
The worst choice? Pretending the SSPL doesn’t apply to you and then learning about it the hard way. Don’t be that person. Either pick Atlas, switch to FerretDB, or get real legal clarity. The 2 AM self will thank you.