Mongita Embedded MongoDB Alternative Announced
Written by Kay Ewbank   
Thursday, 29 April 2021

Mongita, a lightweight embedded document database that implements a commonly-used subset of the MongoDB/PyMongo interface, has been announced. The open source Python library is intended to be useful to Python developers who want to use JSON files but don't want the overhead of a MongoDB server.

Mongita can be configured to store its documents either on disk or in memory. The main developer, Scott Rogowski, says Mongita is a good alternative to SQLite for embedded applications when a document database makes more sense than a relational one.


He also suggests Mongita would be good for unit testing:

"Mocking PyMongo/MongoDB is a pain. Worse, mocking can hide real bugs. By monkey-patching PyMongo with Mongita, unit tests can be more faithful while remaining isolated."

Mongita implements a commonly-used subset of the PyMongo API, meaning that projects could be started with Mongita and upgraded to MongoDB if and when they get large enough to warrant the move. The library is embedded and self contained, doesn't need a server and doesn't start a process.

In terms of performance, Rogowski says Mongita is within an order of magnitude of MongoDB and Sqlite in 10k document benchmarks, and is well tested, with 100% test coverage and more test code than library code.

mongita performance

Another advantage of Mongita is its limited dependencies, as it will run anywhere that Python runs. The only dependencies are pymongo (for bson) and sortedcontainers (for faster indexes). Mongita also offers experimental thread-safety, avoiding race conditions by isolating certain document modification operations.

Rogowski isn't advocating Mongita for all uses, saying it should be avoided in situations that need a traditional server/client configuration as it isn't process-safe, so if you have multiple clients it should be avoided.

It is also limited in the commands it implements, concentrating on the most commonly used subset, so isn't suitable when MongoDB's less common commands are needed. Robowski says the goal is to eventually implement most of MongoDB, but t will take some time to get there.

Performance is another consideration; while Mongita has comparable performance to MongoDB and SQLite for common operations, Robowski admits it's possible you'll find bottlenecks - especially with uncommon operations.


More Information

Mongita On GitHub

Related Articles

MongoDB Trends

Studio3T MongoDB GUI Adds Migration

MongoDB Atlas Adds MultiCloud Cluster Support

MongoDB Improves Query Language

MongoDB 4.0 Gets Multi-Doc ACID Support


To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.


VS Code Improves Docker Support

Visual Studio Code 1.56 has been released with improvements including the ability to manage mounted volumes inside Docker containers. The release also handles clickable events better in the Workbench. [ ... ]

Eclipse 2021-03 Adds Java 16 Support

The Eclipse IDE has been updated for the first time this year. The new version concentrates on improvements to the Java support, with only minor improvements for other languages.

More News





or email your comment to:

Last Updated ( Thursday, 29 April 2021 )