migration

Migrating from MongoDB to FerretDB

Licence and terms

MongoDB
Other, Source available
FerretDB
Apache-2.0, Open source
Fit
Drop-in Speaks the MongoDB wire protocol on top of PostgreSQL.

Compatibility

FerretDB states that all drivers and applications compatible with MongoDB 5.0 and later should work with it over the wire protocol. It keeps MongoDB’s error names and codes. Two differences are permanent: error messages can differ, and collection names must be valid UTF-8, where MongoDB accepts invalid sequences. The project treats any other difference as a bug.

The compatibility page lists the commands that are not implemented yet. Among them:

Before you switch

  1. Test the application against FerretDB first. Start FerretDB with --mode=diff-normal, point --proxy-addr at the MongoDB instance and connect the application or mongosh to --listen-addr. Errors from FerretDB reach the client directly. With --mode=diff-proxy, MongoDB answers and FerretDB shows the difference between the two responses.
  2. Export the data with MongoDB’s own tools. mongodump --uri=... dumps every collection as BSON, and --db or --collection narrows it. mongoexport works one collection at a time with --db, --collection and --out.
  3. Import into FerretDB by pointing mongorestore --uri=... at the FerretDB instance from the dump folder, or mongoimport with --file for each exported collection.

Pitfalls

Official guide

FerretDB's migration guide ↗

Reviewed on 2026-09-29.

Sources

Other alternatives to MongoDB →