Skip to content
Go back

MongoDB Self-Hosted in 2026: SSPL and Alternatives

By SumGuy 8 min read
MongoDB Self-Hosted in 2026: SSPL and Alternatives

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 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:

docker-compose.yml
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:

Use FerretDB if:

Use Atlas (cloud) if:

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:

What’s shaky or missing:

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:

Terminal window
# Spin up the Compose stack
docker compose up -d
# Run your integration tests against FerretDB
export MONGO_URL=mongodb://localhost:27017/testdb
npm test # or pytest, go test, whatever
# If tests pass, you're golden

If 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:

  1. Dump your MongoDB data (using mongodump)
  2. Stand up FerretDB with your new Postgres backend
  3. Restore the data using mongorestore against the FerretDB endpoint
  4. Swap your connection string in your app config
  5. Run your tests (this is where problems show up)
  6. Gradual cutover: send a percentage of traffic to FerretDB, monitor, ramp up
Terminal window
# Export from MongoDB
mongodump --uri="mongodb://mongo-host:27017" --out=./dump
# Start FerretDB stack
cd ferretdb-compose && docker compose up -d
# Import into FerretDB
mongorestore --uri="mongodb://localhost:27017" ./dump

The 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.


Share this post on:

Send a Webmention

Written about this post on your own site? Send a webmention and it'll show up above once verified.


Next Post
Boundary vs Teleport

Discussion

Powered by Garrul . Sign in with GitHub or Google, or post anonymously.

Related Posts