It’s lightweight, requires no external server, and works completely offline. You can use it either with its own Pythonic syntax or in PyMongo compatibility mode, meaning you can often switch from MongoDB to MainyDB by simply changing the import.
What It Does
MainyDB stores data in a single .mdb file and allows querying using Mongo-style operators ($gt, $in, $set, etc.) as well as aggregation pipelines ($match, $group, $lookup, ...). It supports async writes, thread-safe access, and can automatically handle binary data like images or videos through base64 encoding.
PyPI: https://pypi.org/project/MainyDB
GitHub: https://github.com/dddevid/MainyDB
Key Features
Single-file storage (no server process)
Two syntax modes: • Own Pythonic syntax • PyMongo compatibility (drop-in style)
Aggregation pipeline support ($match, $group, $lookup, etc.)
Thread-safe with asynchronous file writes
Built-in binary/media storage (auto-encoded)
Works entirely offline
Target Audience
MainyDB is designed for:
Developers building local or embedded Python apps
Prototyping tools, AI experiments, and desktop applications
Automation scripts that need persistent storage
Students and indie developers who want Mongo-style queries without setup overhead
Not intended (yet) for large-scale production systems; the focus is on simplicity, portability, and fast local development.
Comparison Feature MainyDB MongoDB TinyDB SQLite Server required No Yes No No Mongo syntax Yes Yes No No Aggregation pipeline Yes Yes No No Binary/media support Built-in Manual No No File-based Single .mdb No Yes Yes Thread-safe + async Yes Yes Partial Depends
MainyDB aims to bridge the gap between MongoDB’s expressive document model and TinyDB’s simplicity, giving Python developers a true embedded NoSQL option.
Feedback
It’s an early-stage project. I’d love feedback, benchmarks, feature ideas, and critiques. Is this something you’d use for small apps or prototypes?