|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.
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.
or email your comment to: firstname.lastname@example.org
|Last Updated ( Thursday, 29 April 2021 )|