Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Mongoengine #64

Closed
yamsu opened this issue Oct 6, 2021 · 6 comments
Closed

Support for Mongoengine #64

yamsu opened this issue Oct 6, 2021 · 6 comments
Labels
feature New feature or request

Comments

@yamsu
Copy link

yamsu commented Oct 6, 2021

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?

@davidlatwe
Copy link
Owner

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.

@davidlatwe
Copy link
Owner

Had a quick test and I found we need with_options and create_index implemented in Collection class at least.

@davidlatwe davidlatwe added the enhancement Things need to improve or adopt label Oct 6, 2021
@davidlatwe davidlatwe added feature New feature or request and removed enhancement Things need to improve or adopt labels Dec 9, 2021
@dodolboks
Copy link

hi @davidlatwe @yamsu any update on this issue ? thanks

@davidlatwe
Copy link
Owner

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. :)

@davidlatwe
Copy link
Owner

davidlatwe commented Feb 2, 2023

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:")
...

@davidlatwe
Copy link
Owner

New version released, closing this. Thanks and sorry for the long wait on this one.

davidlatwe added a commit that referenced this issue May 19, 2024
* lmdb: jnwatson/py-lmdb#352
* mongoengine: #64
  and that mongoengine PR has been merged and released, does not
  have to install from git anymore.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants