montydb
montydb copied to clipboard
Support for Mongoengine
Montydb with the sqlite backend provides multi-process operation, at least in my initial trials with just 2 processes writing to the database simultaneously. This is clearly an advantage over mongita, which also provides a file/mem clone of pyMongodb; however, doesn't provide multi-process support. But mongitadb does support Mongoengine which was achieved recently.
Has anyone been able to use Montydb with Mongoengine?
Hi @yamsu , I haven't tried with MongoEngine before, but I think you could try following the setup mentioned here https://github.com/scottrogowski/mongita/issues/4#issuecomment-825839719
Please let me know if it works or not, I will have a deeper look ASAP.
Had a quick test and I found we need with_options
and create_index
implemented in Collection class at least.
hi @davidlatwe @yamsu any update on this issue ? thanks
Hey @dodolboks thanks for asking! I am not sure when I'll be back on this, will try if I can this week. Oh ands, pull requests are welcome of course, even if just some test cases. :)
Minimum change for mongoengine
support has been added into current master branch, should be released shortly.
To try out at this moment, you have to monkey-patch pymongo.MongoClient
as mentioned above (https://github.com/scottrogowski/mongita/issues/4#issuecomment-825839719).
But thanks to the work in https://github.com/MongoEngine/mongoengine/pull/2729, once it's been released (probably v0.27.0
), mongoengine
can simply connect montydb
as follow:
import montydb
import mongoengine
mongoengine.connect(db="test_db",
mongo_client_class=montydb.MontyClient,
repository=":memory:")
...
New version released, closing this. Thanks and sorry for the long wait on this one.