FerretDB logo

FerretDB

MongoDB‑compatible proxy that runs on PostgreSQL as a document database

FerretDB is a drop‑in MongoDB 5.0+ replacement that translates MongoDB wire protocol to SQL, storing data in PostgreSQL with the DocumentDB extension, offering an open‑source document database solution.

FerretDB banner

Overview

What FerretDB Is

FerretDB acts as a proxy, converting MongoDB 5.0+ wire‑protocol queries into SQL statements that run on PostgreSQL equipped with the DocumentDB extension. It lets any application that uses a MongoDB driver interact with a relational backend without changing code.

Who Should Use It

The project targets developers and teams that appreciate MongoDB’s ease of use but need an open‑source, Apache‑2.0 licensed alternative. It is especially useful for those already comfortable with PostgreSQL tooling, backups, and ecosystem, while still wanting to keep existing MongoDB client libraries.

Getting Started

A ready‑made Docker image bundles FerretDB, PostgreSQL, and the DocumentDB extension for quick experiments. For production, users can deploy FerretDB alongside a managed or self‑hosted PostgreSQL instance, or embed the Go library directly into their services.

Highlights

MongoDB driver compatibility (5.0+)
SQL translation layer using PostgreSQL DocumentDB
Docker image with pre‑bundled PostgreSQL for quick start
Go library for embedding FerretDB

Pros

  • Open‑source Apache‑2.0 license
  • Leverages mature PostgreSQL ecosystem
  • Drop‑in replacement for many MongoDB tools
  • Active community and roadmap

Considerations

  • Not 100% feature‑parity with MongoDB
  • Performance may differ for complex queries
  • Production‑ready deployment requires manual PostgreSQL setup
  • Limited advanced MongoDB features (e.g., sharding)

Managed products teams compare with

When teams consider FerretDB, these hosted platforms usually appear on the same shortlist.

Azure Cosmos DB logo

Azure Cosmos DB

Fully managed, globally distributed NoSQL database service offering multi-model support with low-latency access worldwide

MongoDB logo

MongoDB

Document-oriented NoSQL database for flexible data storage

Looking for a hosted option? These are the services engineering teams benchmark against before choosing open source.

Fit guide

Great for

  • Teams seeking an open‑source MongoDB‑compatible database without SSPL licensing
  • Developers wanting to reuse existing MongoDB drivers while storing data in PostgreSQL
  • Projects that value SQL‑based backups and tooling
  • Startups needing a cost‑effective document store for prototyping

Not ideal when

  • Workloads requiring full MongoDB feature set like sharding or Atlas
  • High‑throughput analytics that depend on MongoDB’s native query engine
  • Environments where you cannot manage a PostgreSQL instance
  • Applications needing strict MongoDB version compatibility beyond 5.0

How teams use it

Rapid prototyping of a Node.js app

Developers can connect with the standard MongoDB driver, store data in PostgreSQL, and iterate without licensing concerns.

Embedding FerretDB in a Go microservice

The Go library lets the service serve MongoDB‑compatible endpoints while keeping data in the same process.

Migrating an existing MongoDB test suite to CI

Docker image provides a disposable environment that mimics MongoDB behavior for automated tests.

Running a managed FerretDB instance on a cloud provider

Leverages providers like Civo or Tembo to run FerretDB with managed PostgreSQL, simplifying production deployment.

Tech snapshot

Go91%
JavaScript5%
MDX3%
Dockerfile1%
Smarty1%
C1%

Tags

postgresqlgohacktoberfestmongo-dbmongopostgresdocumentferretdbmongodb-databasedatabasegolangmongodb

Frequently asked questions

Does FerretDB support MongoDB authentication mechanisms?

FerretDB implements the basic SCRAM‑SHA‑1 and SCRAM‑SHA‑256 mechanisms required for most drivers; advanced auth plugins are not yet supported.

Can I use FerretDB with an existing PostgreSQL database?

Yes, you can point FerretDB to any PostgreSQL instance that has the DocumentDB extension installed.

Is data persisted across container restarts?

The provided evaluation Docker image stores data only in the container’s temporary volume; for production you must mount a persistent PostgreSQL volume.

How does performance compare to native MongoDB?

Performance varies by workload; simple CRUD operations are comparable, while complex aggregations may be slower due to SQL translation.

What licensing does FerretDB use?

FerretDB is released under the Apache‑2.0 license, allowing free use in open‑source and commercial projects.

Project at a glance

Active
Stars
10,813
Watchers
10,813
Forks
472
LicenseApache-2.0
Repo age4 years old
Last commit15 hours ago
Primary languageGo

Last synced 3 hours ago