Document Database

Hanzo DocDB

MongoDB-compatible document database

Drop-in MongoDB wire-protocol compatibility on top of PostgreSQL. Same drivers, same queries, same aggregation pipeline — with ACID transactions and SQL access for analytics.

Mongo Wire
Compatible
ACID
Transactions
PostgreSQL
Engine
SQL
Access

Documents Without Lock-In

Your existing MongoDB code, running on open PostgreSQL.

Mongo Wire Protocol

Native MongoDB 6+ wire compatibility. Plug in your existing pymongo, mongoose, or mongo-go-driver client. No code changes.

Aggregation Pipeline

Full $match, $group, $lookup, $unwind, $facet support. Window functions and complex analytics over JSONB documents.

ACID Transactions

Multi-document, multi-collection transactions backed by PostgreSQL MVCC. Real serializable isolation, no eventual consistency surprises.

Hybrid Indexing

GIN indexes for arbitrary JSONB queries. B-tree for sorted scans. pg_trgm for fuzzy text. Compound indexes that just work.

SQL Side-Door

Query the same collections via SQL/JSONB for reporting and analytics. No ETL — your operational store is your warehouse.

PostgreSQL Power

Inherits everything: streaming replication, point-in-time recovery, logical replication, role-based access. Enterprise from day one.

Drop-In MongoDB Replacement

app.ts
import { MongoClient } from 'mongodb';

// Same driver. Different connection string. That's it.
const client = new MongoClient(process.env.HANZO_DOCDB_URI);
await client.connect();

const orders = client.db('shop').collection('orders');

// Aggregation pipelines run unchanged
const top = await orders.aggregate([
  { $match: { status: 'paid' } },
  { $group: { _id: '$customer_id', total: { $sum: '$amount' } } },
  { $sort: { total: -1 } },
  { $limit: 10 },
]).toArray();

Get started with DocDB

Open source

License: Apache-2.0hanzoai/docdb

Forked from FerretDB (Apache-2.0). We track upstream and contribute fixes back where possible.

Get DocDB

Document DB over PostgreSQL