{% extends "base.html" %} {% block title %}MonaDB{% endblock title %} {% block description %}MonaDB is an embedded document store for Python. Python dict semantics over ordered keys, in a single file.{% endblock description %} {% block content %}

Preview · Embedded Document Store

MonaDB

MonaDB is an embedded document store for Python. It behaves like a dict of dicts and commits like a database. No schema, no server, no query language to learn. A Rust core on redb, documents as BSON.

pip install monadb copy
monadb ❯ console v0.2
# a collection is a dict; a document is its value
import monadb
db = monadb.open("app.db")
db["users"]["alice"] = {"age": 30}
db["users"]["alice"]   # {"age": 30}
  committed redb · BSON
Embedded
No server, no configs
Schemaless
Nested objects, arrays, no schema
Dict
The API you already know
01

Why Use MonaDB?

Use cases
01 · Interface

Dict

Subscript, in, len, iteration, update, pop. It is a MutableMapping, so the methods you expect are simply there.

02 · Ordering

Ordered

Keys use an order-preserving encoding, so iteration is sorted and range and prefix scans come free from the b-tree.

03 · Runtime

Embedded

Backed by redb and running in-process alongside your code. One file on disk. No server, no daemon, no config to babysit.

04 · Concurrency

One commit each

Every operation is its own commit, and update() commits a whole mapping at once. Readers never block; writers serialize.

02

How It Holds

No query language.

There is nothing to learn beyond the mapping protocol. Filtering is a comprehension over an iteration or a range — ordinary Python, on ordinary dicts.

Small enough to read.

The Rust core is seven files and three dependencies, and it compiles with unsafe forbidden outright.

The database is a library.

MonaDB runs in the same process as your code and reads from a single file on disk. There is no network hop between your application and your data.

Honest about the differences.

It is not quite a dict: iteration is key order, keys are typed, values are documents. All six differences are written down and asserted in the test suite.

Getting Started

Try MonaDB.

Install MonaDB and open a Python shell. One import, one file, no servers.

pip install monadb copy
{% endblock content %}