Skip to main content
https://travis-ci.org/graphql-python/graphene-mongo.svg?branch=master https://coveralls.io/repos/github/graphql-python/graphene-mongo/badge.svg?branch=master https://badge.fury.io/py/graphene-mongo.svg https://img.shields.io/pypi/pyversions/graphene-mongo.svg

Graphene-Mongo

A Mongoengine integration for Graphene.

Installation

For instaling graphene-mongo, just run this command in your shell

pip install graphene-mongo

Examples

Here is a simple Mongoengine model as models.py:

from mongoengine import Document
from mongoengine.fields import StringField

class User(Document):
    meta = {'collection': 'user'}
    first_name = StringField(required=True)
    last_name = StringField(required=True)

To create a GraphQL schema for it you simply have to write the following:

import graphene

from graphene_mongo import MongoengineObjectType

from .models import User as UserModel

class User(MongoengineObjectType):
    class Meta:
        model = UserModel

class Query(graphene.ObjectType):
    users = graphene.List(User)

    def resolve_users(self, info):
        return list(UserModel.objects.all())

schema = graphene.Schema(query=Query)

Then you can simply query the schema:

query = '''
    query {
        users {
            firstName,
            lastName
        }
    }
'''
result = schema.execute(query)

To learn more check out the Flask MongoEngine example

Metadata

Release files for graphene-mongo 0.1.13

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for graphene-mongo 0.1.13
File Size Uploaded Provenance Actions
graphene-mongo-0.1.13.tar.gz 13.0 kB Without provenance Details for graphene-mongo-0.1.13.tar.gz

Release files / graphene-mongo-0.1.13.tar.gz

Download URL graphene-mongo-0.1.13.tar.gz
Size 13.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9645dff0cebfa81a67eafe12aadc2d50d1049a56bfef4b7ad9bcfb0dfb691fd7
BLAKE2b-256 checksum
How to use checksums
5e1718c52e43e1d5d8ae35948e3d46d2a91177b801e80dc2a540bc7dcdc8ef37
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for graphene-mongo 0.1.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.13 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page