# Hanzo DocDB — Hanzo AI

> Drop-in MongoDB wire-protocol compatibility on top of Hanzo SQL.

Document Database

# Hanzo DocDB

Documents on the MongoDB wire, stored in Hanzo SQL

DocDB answers the MongoDB wire protocol on 27017 and stores nothing itself: it translates each command into SQL and runs it against Hanzo SQL. Your driver connects, your documents go in as documents — and the same data is sitting in a database you can also point a SQL client at, back up and replicate the way you already do.

27017

Wire protocol

ACID

Transactions

Hanzo SQL

Engine

HTTP

And MCP

[Get Started](https://docs.hanzo.ai/docs/docdb)[GitHub](https://github.com/hanzoai)

## A document store with a SQL database under it

Write documents. Keep every operational habit you already have.

### The wire protocol, not a REST shim

DocDB speaks MongoDB 5.0 and later on the wire, so pymongo, mongoose, the Go driver and mongosh connect to it directly. Around sixty commands are implemented — find, insert, update, delete, findAndModify, distinct, count, createIndexes, explain and the rest.

### Aggregation runs in the database

A pipeline is translated to SQL and executed where the data is, not pulled across the wire and reduced in your process. explain returns the plan the query actually took — a Hanzo SQL plan, for something you wrote as a pipeline.

### Transactions, and someone else&#x27;s durability

Multi-document writes commit or roll back together under Hanzo SQL&#x27;s MVCC. Backups, point-in-time recovery and replicas belong to the database — DocDB holds no state of its own, so there is nothing here that can be lost separately.

### Indexes are real indexes

createIndex from the driver builds a Hanzo SQL index, and listIndexes reads back what is actually there. Nothing is emulated in a layer above the planner, so an index you create is one the planner can use.

### The SQL side door

The documents are rows in Hanzo SQL, so a reporting tool, a dbt model or a psql session can read them where they sit. The reporting copy and the operational copy are the same copy.

### An HTTP door and an agent door

The same collections answer over plain HTTP — /action/find, /action/insertOne, /action/aggregate and the rest, with an OpenAPI document to generate from — and over the Model Context Protocol, so an agent can list databases and query them with no driver at all.

## Connect the driver you already have

app.ts

```
import { MongoClient } from &#x27;mongodb&#x27;; // Same driver. New connection string. const client = new MongoClient(process.env.HANZO_DOCDB_URI); await client.connect(); const orders = client.db(&#x27;shop&#x27;).collection(&#x27;orders&#x27;); // Aggregation pipelines run unchanged const top = await orders.aggregate([ { $match: { status: &#x27;paid&#x27; } }, { $group: { _id: &#x27;$customer_id&#x27;, total: { $sum: &#x27;$amount&#x27; } } }, { $sort: { total: -1 } }, { $limit: 10 }, ]).toArray();
```

## Get started with DocDB

[Read the docs](https://docs.hanzo.ai/docs/docdb)[View on GitHub](https://github.com/hanzoai)

## Open source

License: Apache-2.0[hanzoai](https://github.com/hanzoai)

## Get DocDB

Document DB over Hanzo SQL

[Deploy to Cloud](https://console.hanzo.ai/deploy)[Self-host](https://docs.hanzo.ai/docs/docdb)
