Skip to content

Commit f7229dc

Browse files
committed
chore: Bump version to 0.1.12
1 parent 07ca75f commit f7229dc

File tree

4 files changed

+93
-5
lines changed

4 files changed

+93
-5
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@ To learn more check out the following [examples](examples/):
7272
- [ ] Examples
7373
- [x] Flask example
7474
- [ ] Django example
75-
- [ ] Filtering & Paging
75+
- [x] Filtering & Paging
7676
- [x] Default filtering enabled with all model's attributes by equal comparison (requester: [git-albertomarin](https://github.com/git-albertomarin))
7777
- [x] Take first, or last n items (credit: [alexpantyukhin](https://github.com/alexpantyukhin))
7878
- [x] Filter by global id (requester: [bwalsh](https://github.com/bwalsh))
79-
- [ ] Advanced filtering
79+
- [x] Filter by reference model id (requester: [msholty-fd](https://github.com/msholty-fd))
8080
- [ ] Support more types ([Currently supported](http://graphene-mongo.readthedocs.io/en/latest/fields.html#))
8181
- [x] Self-reference and list-of-self-reference relationship (requester: [mehdiym](https://github.com/mehdiym))
8282

README.rst

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
.. image:: https://travis-ci.org/graphql-python/graphene-mongo.svg?branch=master
2+
:target: https://travis-ci.org/graphql-python/graphene-mongo
3+
.. image:: https://coveralls.io/repos/github/graphql-python/graphene-mongo/badge.svg?branch=master
4+
:target: https://coveralls.io/github/graphql-python/graphene-mongo?branch=master
5+
.. image:: https://badge.fury.io/py/graphene-mongo.svg
6+
:target: https://badge.fury.io/py/graphene-mongo
7+
.. image:: https://img.shields.io/pypi/pyversions/graphene-mongo.svg
8+
:target: https://pypi.python.org/pypi/graphene-mongo/
9+
10+
Graphene-Mongo
11+
==============
12+
13+
A `Mongoengine <https://mongoengine-odm.readthedocs.io/>`__ integration for `Graphene <http://graphene-python.org/>`__.
14+
15+
Installation
16+
------------
17+
18+
For instaling graphene-mongo, just run this command in your shell
19+
20+
.. code:: bash
21+
22+
pip install graphene-mongo
23+
24+
Examples
25+
--------
26+
27+
Here is a simple Mongoengine model as `models.py`:
28+
29+
.. code:: python
30+
31+
from mongoengine import Document
32+
from mongoengine.fields import StringField
33+
34+
class User(Document):
35+
meta = {'collection': 'user'}
36+
first_name = StringField(required=True)
37+
last_name = StringField(required=True)
38+
39+
40+
To create a GraphQL schema for it you simply have to write the following:
41+
42+
.. code:: python
43+
44+
import graphene
45+
46+
from graphene_mongo import MongoengineObjectType
47+
48+
from .models import User as UserModel
49+
50+
class User(MongoengineObjectType):
51+
class Meta:
52+
model = UserModel
53+
54+
class Query(graphene.ObjectType):
55+
users = graphene.List(User)
56+
57+
def resolve_users(self, info):
58+
return list(UserModel.objects.all())
59+
60+
schema = graphene.Schema(query=Query)
61+
62+
Then you can simply query the schema:
63+
64+
.. code:: python
65+
66+
query = '''
67+
query {
68+
users {
69+
firstName,
70+
lastName
71+
}
72+
}
73+
'''
74+
result = schema.execute(query)
75+
76+
To learn more check out the `Flask MongoEngine example <https://github.com/graphql-python/graphene-mongo/tree/master/examples/flask_mongoengine>`__
77+

docs/fields.rst

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
Supported Mongoengine Fields
1+
Supported Fields
22
============================
33

4+
Mongoengine Fields
5+
------------------
6+
47
- BooleanField
58
- DecimalField
69
- DateTimeField
@@ -17,3 +20,10 @@ Supported Mongoengine Fields
1720
- URLField
1821
- UUIDField
1922

23+
24+
Advanced
25+
--------
26+
27+
- Self-reference relationship
28+
- List of self-reference relationship
29+
- Inheritance field

setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
setup(
44
name='graphene-mongo',
5-
version='0.1.10',
5+
version='0.1.12',
66

77
description='Graphene Mongoengine integration',
8-
# long_description=open('README.rst').read(),
8+
long_description=open('README.rst').read(),
9+
# long_description_content_type='text/markdown',
910

1011
url='https://github.com/graphql-python/graphene-mongo',
1112

0 commit comments

Comments
 (0)