Skip to content

Connect to FerretDB (MongoDB-compatible)

Tested with: FerretDB 2.4.0 with DocumentDB on PostgreSQL 17 · drivers listed per tab · zb CLI 0.1

FerretDB speaks the MongoDB wire protocol and stores documents in a PostgreSQL cluster with the DocumentDB extension, rendered alongside your instance. You use standard MongoDB drivers; backups are PostgreSQL backups with point-in-time recovery.

  1. Copy the host and port from Connect.
  2. Download the CA bundle (zb api GET /v1/orgs/{org}/ca.pem > databasezy-ca.pem) if your driver does not read the OS trust store.
  3. Add your egress IPs under Network → Allow-list.
  4. Connect with tls=true, authSource=admin and authMechanism=SCRAM-SHA-256, as in every snippet below.

FerretDB (MongoDB-compatible) listens on port 27017 (MongoDB wire protocol). Versions: 2.7, 2.4. Replace the example host with the one on your instance's Connect tab; credentials are shown once at creation.

Connection URI
mongodb://app:<password>@ferret-7f3k.us-east.databasezy.com:27017/app?tls=true&tlsCAFile=databasezy-ca.pem&authSource=admin&authMechanism=SCRAM-SHA-256
db.js
import { MongoClient } from "mongodb";
const uri = `mongodb://app:${process.env.ZB_PASSWORD}@ferret-7f3k.us-east.databasezy.com:27017/app`
+ "?tls=true&authSource=admin&authMechanism=SCRAM-SHA-256";
export const client = new MongoClient(uri, {
tlsCAFile: "databasezy-ca.pem", // omit if the OS trust store already has the CA
maxPoolSize: 10,
});
await client.connect();
console.log(await client.db("app").command({ ping: 1 }));

Tested with: FerretDB (MongoDB-compatible) 2.7 · mongodb 6.10 (Node driver)

  • Supported: CRUD, aggregation pipeline (most stages), indexes including compound and TTL, change streams are not supported yet, transactions are single-document.
  • Run db.runCommand({ buildInfo: 1 }) to see the FerretDB and DocumentDB versions.
  • Applications that depend on $text search, GridFS or multi-document transactions should use the Percona Server for MongoDB engine instead; its engine page shows whether it is orderable yet.

Each MongoDB client keeps its own pool (maxPoolSize); one client per process is the norm. Every FerretDB connection maps to a PostgreSQL connection, so the size’s max_connections is the real ceiling.