Graphene: PyMongo and/or Mongoengine Integration

Created on 25 Nov 2015  Â·  11Comments  Â·  Source: graphql-python/graphene

It should be useful to have a mongoengine easy integration

✨ enhancement 🙋 help wanted

Most helpful comment

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.

All 11 comments

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)

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

@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

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.

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

wheee, nobody did tests in their implementations.

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/

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.

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.

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! :beers:

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Globegitter picture Globegitter  Â·  4Comments

japrogramer picture japrogramer  Â·  4Comments

lincolnq picture lincolnq  Â·  3Comments

ghoshabhi picture ghoshabhi  Â·  3Comments

mingzhou picture mingzhou  Â·  3Comments