davidlatwe / montydb

Monty, Mongo tinified. MongoDB implemented in Python !

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for Mongoengine

yamsu opened this issue · comments

commented

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 scottrogowski/mongita#4 (comment)

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 (scottrogowski/mongita#4 (comment)).

But thanks to the work in MongoEngine/mongoengine#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.