Why MingleDB?
Many apps need structured, queryable data without operating a database cluster. SQLite solved that for SQL; MingleDB aims at the same simplicity for document collections and MongoDB-style filters—in one portable file.
What you get
A single .mgdb file holds your collections. You authenticate users,
define schemas per collection, and run CRUD with operators like
$gt, $in, and $regex—familiar if you have used MongoDB’s query
language, but with no server process and no wire protocol. Official libraries exist
for Node.js, Python, and Go, plus a CLI for interactive work and
scripts.
vs. SQLite
SQLite is ideal for relational rows and SQL. Choose MingleDB when your model is naturally documents (nested fields, flexible shapes) and you want operator-based filters instead of SQL strings.
vs. MongoDB server
MongoDB targets distributed deployments and rich tooling. MingleDB is for local-first or embedded use: one file, no daemon, minimal ops—while keeping a similar query vocabulary for filters and updates.
When it fits
Desktop apps, CLIs, prototypes, offline caches, and small services that should not depend on a remote DB. See Use Cases on the home page for concrete examples.
Official implementations
Each port implements the same core ideas; APIs follow language conventions (camelCase in JavaScript, snake_case in Python, idiomatic Go). Feature coverage below is what the reference engine supports across projects.
mingledb (Node.js)
The reference JavaScript implementation for Node and bundlers. Ships with user
registration and login, per-collection schemas (required fields, types, uniqueness),
the full operator set ($gt, $gte, $lt, $lte, $eq, $ne, $in, $nin,
$regex), persistence to a single database file, and CRUD:
insertOne, find, findOne, findAll, updateOne, deleteOne. Use it when your
stack is already JavaScript or TypeScript and you want the smallest path from npm install
to working data.
gomingleDB (Go)
Native Go API with parity on auth, schemas, operators, and CRUD. Suitable for CLIs,
services, and static binaries where embedding a file-backed document store avoids CGO or
external services. Exposes Reset() to clear the on-disk file and in-memory schema
state when you need a clean slate in tests or tooling.
pymingleDB (Python)
Python bindings with optional schema validation, the same operators (including
$regex with $options for case-insensitive and multiline flags where supported),
snake_case method names, and reset() for wiping storage. Fits notebooks, scripts,
and backends that already use PyPI packages—same file format as the other ports for
round-tripping data.
mingledb-cli
Interactive shell for .mgdb files (or paths that resolve to one database file).
Dot commands cover discovery (.collections, .tables, .schema), session
(.help, .exit, .open, .databases), output (.output), and auth
(.auth). Run insert, find, findOne, update, and delete with JSON documents and
filter objects—ideal for debugging, migrations, and quick inspection without writing a
throwaway script.
Shared Core Engine Features
User Authentication
Built-in user accounts mean you can gate access to your database from the same process that opens the file—no OAuth provider or HTTP middleware required for simple cases. Register with a username and password, log in to establish a session, log out when done, and query whether a user is currently authenticated. That is enough for single-user tools, shared kiosks, or prototypes where you only need basic identity, not federation.
Code example
2
3
4
5
db.registerUser("admin", "secure123");
db.login("admin", "secure123");
db.isAuthenticated("admin"); // true
db.logout("admin");
Schema Definition
Each collection can have a schema object: field names map to types such as
string and number, with required to reject documents missing fields and
unique to enforce no duplicate values in that field (for example one account per
email). Validation runs on insert and update, so bad data never silently lands
in the file. You can evolve schemas as your app grows—tighten constraints when you
are ready, or start without a schema and add one later where ports support it.
Code example
2
3
4
5
6
db.defineSchema("users", {
name: { type: "string", required: true },
email: { type: "string", required: true, unique: true },
age: { type: "number" },
});
Smart Querying
Filters use the same style of operator objects many developers know from
MongoDB: comparisons ($gt, $gte, $lt, $lte), equality ($eq, $ne),
membership ($in, $nin), and pattern matching ($regex). Nest operators to
express ranges (e.g. age between 18 and 65) or combine conditions across fields. The
same filter document applies to find, findOne, updateOne, and deleteOne, so
you learn one pattern and reuse it everywhere.
Code example
2
3
db.find("users", { age: { $gte: 18, $lt: 65 } });
db.find("users", { email: { $in: ["a@b.com", "c@d.com"] } });
Compression
On-disk layout is designed to stay compact for typical document workloads, so
your .mgdb file remains easy to copy, back up, or attach to a bug report. Because
the format is shared across official ports, you can create data in Node, inspect it
with the CLI, and process it in Python or Go without a separate export step—as long
as you use compatible library versions.
Flat File Storage
Everything lives in one database file: all collections and metadata share that path. There is no background daemon—your process opens the file, acquires whatever locking the implementation provides, and persists changes. That makes backups a file copy, simplifies “reset this machine” stories, and runs in air-gapped or container environments where opening a TCP port to MongoDB or Postgres is not an option.
CRUD Operations
Create documents with insertOne. Read with find (filtered),
findOne (first match), or findAll (optionally filtered). Update with
updateOne using a filter plus new field values. Delete with deleteOne and a
filter. The filter object uses the same operator vocabulary everywhere, which keeps
mental load low when you move from querying to updating or removing rows.
Code example
2
3
4
5
db.insertOne("users", { name: "Alice", age: 30 });
db.findAll("users");
db.updateOne("users", { name: "Alice" }, { age: 31 });
db.deleteOne("users", { name: "Alice" });
MingleDB CLI
The official shell talks to the same engine as the libraries. Point it at a
.mgdb file (or a directory that resolves to one), then use dot commands for
meta-tasks: help, exit, listing databases and collections, viewing schema, toggling
auth context, and controlling how results print. Data commands accept JSON for
documents and filters—insert, find, findOne, update, delete—so you can
reproduce production queries during support or migrate small datasets without a
custom script.
Code example
2
3
4
5
6
7
8
9
$ ./mgdb ./mydb
mingledb> .collections
users
mingledb> insert users {"name":"Alice","email":"alice@example.com","age":30}
Inserted 1 document.
mingledb> find users {"age":{"$gte":18}}
{ "name": "Alice", "email": "alice@example.com", "age": 30 }
(1 document(s))