Skip to content

PyMongo and/or Mongoengine Integration #51

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

Closed
sibelius opened this issue Nov 25, 2015 · 11 comments
Closed

PyMongo and/or Mongoengine Integration #51

sibelius opened this issue Nov 25, 2015 · 11 comments

Comments

@sibelius
Copy link

It should be useful to have a mongoengine easy integration

@msoedov
Copy link

msoedov commented Dec 1, 2015

As temporary workaround I used https://github.com/msoedov/flask-graphql-example/blob/master/ql.py#L13-L20

    def resolve_user(self, args, info):
        u = User.objects.get(email=args.get('email'))
        return construct(UserField, u)

@dmzkrsk
Copy link

dmzkrsk commented Feb 4, 2016

Hello, I started a project for MongoEngine integration

https://github.com/dmzkrsk/graphene-mongoengine

I copied code from contrib.django and contrib.sqlalchemy and replaced classes with mongoengine ones.

It's in pretty early stage, I have no docs, tests, but it has working fields, relations, relay. Mutations not tested yet.

Please join, test on your projects, add tests, etc

@sibelius
Copy link
Author

sibelius commented Feb 4, 2016

@dmzkrsk that's great to know

take a look at https://github.com/RisingStack/graffiti-mongoose, it's have the same ideia but for JS

@subodhpareek18
Copy link

Hi is there any movement on this issue to the best of your knowledge @syrusakbary @dmzkrsk?
This seems to be almost an year old request.

@ozanturksever
Copy link

i did a impl here https://github.com/ozanturksever/graphene-mongoengine
it is mostly code modifed from graphine-django

@gordol
Copy link

gordol commented Dec 6, 2016

wheee, nobody did tests in their implementations.

@yfilali
Copy link

yfilali commented Dec 6, 2016

FYI: https://github.com/yfilali/graphql-pynamodb is a recent implementation for dynamodb, Amazon's NoSQL database. I am not too familiar with mongodb, but the basic structure should be very similar to @ozanturksever implementation. I also had the need to implement relationship attributes. So maybe that could be of use to the mongo port. The MongoDB documentation on "Model One-to-Many Relationships with Document References" seems pretty close to the pattern I ended up implementing: https://docs.mongodb.com/v3.0/tutorial/model-referenced-one-to-many-relationships-between-documents/

@syrusakbary
Copy link
Member

As of the time of writing, there are two Graphene-MongoEngine integrations:
https://github.com/tomasgarzon/graphene-mongoengine by @tomasgarzon
https://github.com/ozanturksever/graphene-mongoengine by @ozanturksever

Would love to integrate one or another into the graphql-python community.

Closing the issue, but please comment if you would like to be the official maintainer for graphene-mongoengine in the graphql-python community.

@gordol
Copy link

gordol commented Jun 26, 2017

hmm, seems to me that neither of those implementations are complete... not all object types are supported, for example, and relations are also not supported by either implementation.

p0123n pushed a commit to p0123n/graphene that referenced this issue Aug 26, 2017
Allow subclassing of SQLAlchemyObjectType without major API changes
ronachong pushed a commit to ronachong/graphene that referenced this issue Nov 3, 2017
Fix missing operation_name warning
@abawchen
Copy link
Contributor

abawchen commented Jan 26, 2018

Hello,

After checking, these 2 repos
https://github.com/tomasgarzon/graphene-mongoengine
https://github.com/ozanturksever/graphene-mongoengine
does not support graphene 2.0 and neither relationship.

So I start https://github.com/abawchen/graphene-mongo, which supports one-to-one with ReferenceField and one-to-many with List(ReferenceField), and I have some basic test cases as well.

Hope it helps.

Thanks @tomasgarzon & @ozanturksever, got a lot from your implementation! 🍻

@syrusakbary
Copy link
Member

Based on @abawchen initiative, we started the official repo Graphene-mongo that @abawchen will be leading.
https://github.com/graphql-python/graphene-mongo

Any more contributors will be welcome, so please write here if anyone is interested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants