LinuxWindows

Where Does FerretDB Store Data?

FerretDB itself is stateless. Your data sits in the backing PostgreSQL directory, set by config or env.

Last updated

FerretDB translates the Mongo wire protocol into PostgreSQL storage. Documents land in Postgres tables, so the data directory that matters is the Postgres one. The official Postgres Docker image uses /var/lib/postgresql/data, while distro packages use versioned folders instead.

Docker setups change the picture. Named volumes hide the data dir inside Docker storage, and compose files often remap it. Check the volume mounts and FERRETDB_POSTGRESQL_URL first. The FerretDB process directory itself contains nothing worth saving.

Where FerretDB stores this, by platform

Linux
/var/lib/postgresql/data

Backing Postgres data dir in the official Docker image. Debian packages instead use a versioned folder like /var/lib/postgresql/16/main. Confirm with FERRETDB_POSTGRESQL_URL and your volume mounts.

Windows
C:\Program Files\PostgreSQL\[version]\data

Native Windows Postgres data dir, with the version number in the middle. Docker based installs keep data in a volume instead. Match the bracketed part to the Postgres version you installed.

Frequently asked questions

How do I back up FerretDB data?

Back up PostgreSQL, not FerretDB. pg_dump or a volume snapshot of the Postgres data dir captures everything. FerretDB holds no documents of its own, so its container needs no backup.

How do I move FerretDB to another Postgres?

Point FERRETDB_POSTGRESQL_URL at the new instance and restart. Connection strings for your apps stay pointed at FerretDB itself. The move is transparent to Mongo drivers.

Notice an outdated path? Let us know.