The Python reference implementation
Where SecantusDB started, and still the specification everything else is measured against. A real MongoDB server and a real PostgreSQL server in pure Python, on the same WiredTiger engine — readable end to end, embeddable in two lines, and the place every operator, stage and error message lands first. If you are looking for something to run, you want the Rust servers; this is the one you read.
Drop-in for pymongo
Same wire protocol, same handshake, same error codes. The application code is byte-identical — only the setup line changes.
mongod running on :27017
from pymongo import MongoClient
client = MongoClient("mongodb://localhost:27017")
db = client["mydb"]
db["users"].insert_one({"_id": 1, "name": "Joe"})
assert db["users"].find_one({"_id": 1})["name"] == "Joe"
from pymongo import MongoClient
from secantus import SecantusDBServer
with SecantusDBServer(port=27017) as server:
client = MongoClient(server.uri)
db = client["mydb"]
db["users"].insert_one({"_id": 1, "name": "Joe"})
assert db["users"].find_one({"_id": 1})["name"] == "Joe"
What the reference gives you
Everything below is implemented here first and ported to Rust second, with parity suites that fail the build the moment the two engines disagree on a single byte. Reading this list is reading what SecantusDB does — on either runtime. Each panel links to the reference docs.
Drop-in wire protocol
Speaks MongoDB OP_MSG / OP_QUERY on a real TCP socket. pymongo, the Go driver, mongosh, and mongodump all connect with no code changes.
Single-node by design
No replica sets, no sharding, no cluster topology to model. Within single-node scope SecantusDB is a faithful surrogate — same handshake, same error codes.
Python-native & embeddable
Start a server in two lines from any test or app. No mongod to install, no port juggling, parallel-test friendly. Or run it as a standalone daemon (secantusd-py).
Real WiredTiger storage
The same C library MongoDB ships with, vendored and built into the wheel. B-trees, page eviction, write-ahead logging, durability — all real.
Aggregation pipeline
Full pipeline — $match, $group (every mongod accumulator), $lookup with index-driven joins, $facet, $bucket, $densify, $fill, $merge, $out, $graphLookup, $geoNear. Same expression language as mongod.
Geospatial — 2d & 2dsphere
$geoWithin, $geoIntersects, $near, $nearSphere, $geoNear all accelerated by either index type. S2 cell coverings for GeoJSON; quadtree-decomposed Z-order ranges for legacy [x, y] pairs. Compound geo+scalar indexes work too.
Native TLS & mTLS
Wraps accepted sockets in TLS before the wire protocol starts — no reverse proxy required. Add a CA bundle for mTLS (transport-layer client-cert verification). SCRAM-SHA-256 still identifies the user on top.
Change streams
Oplog-backed, single-node. watch() at collection / db / cluster scope, resume tokens, fullDocument: "updateLookup", pre-images via changeStreamPreAndPostImages, awaitData blocking.
Conformance-tested
Validated against thirteen unmodified upstream driver suites — pymongo (sync and async), Java, Kotlin, Node.js, Go, Ruby, Rust, PHP (the library and the C extension), C, C++ and C#/.NET. The pass rates are the honest compatibility gauge.
Performance
Said plainly: a like-for-like benchmark has the Python server 2.0×–25.0× slower per operation than mongod, and losing throughput rather than gaining it as writers are added — down to ~0.6× its own single-writer rate at eight. The storage engine is the same WiredTiger C library; the layers above it are Python, and the GIL is where the throughput goes. It degrades gracefully — write conflicts retry server-side exactly as mongod's writeConflictRetry does, and a client never sees an error — which is what makes it fine for ephemeral test and dev data, and not fine for anything under load. The Rust MongoDB server runs the same workloads 1.8×–13.1× faster and scales with writers. Three-way benchmarks →
It speaks SQL too — and that is where the Rust one came from
The Python SQL/PostgreSQL frontend came first: the same WiredTiger data reachable over the PostgreSQL wire protocol — psql, psycopg, SQLAlchemy — where a document written with pymongo reads back as a row. It is validated against psycopg 3's own unmodified test suite, the sqllogictest corpus and SQLAlchemy's dialect-compliance suite, and it is the most complete SQL surface the project has. The Rust PostgreSQL server is its port — younger, faster, and still catching up on surface area.
Get it
Embedded (two lines)
pip install SecantusDB
# then in your test or app:
with SecantusDBServer(port=0) as server:
client = MongoClient(server.uri)
Standalone daemon
secantusd-py --port 27017 --storage-path ./data
# PostgreSQL wire:
secantusd-py-pg --port 5432 --storage-path ./data
Python reference documentation: Quickstart · The two servers · SQL interface · Backup & PITR · Feature comparison