You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+16-20Lines changed: 16 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,6 @@
1
1
graphql-compose-mongoose
2
2
======================
3
-
This is a plugin for [graphql-compose](https://github.com/nodkz/graphql-compose), which derives a bunch of GraphQL types and resolvers from mongoose models.
4
-
3
+
This is a plugin for [graphql-compose](https://github.com/nodkz/graphql-compose), which derives GraphQLType from your [mongoose model](https://github.com/Automattic/mongoose). Also derives bunch of internals GraphQL Types. Provide all CRUD resolvers, including `graphql connection`.
Modules `graphql`, `graphql-compose`, `graphql-compose-connection`, `mongoose` are in `peerDependencies`, so should be installed explicitly in your app. They have global objects and should not have ability to be installed as submodule.
12
11
13
-
14
12
Example
15
13
=======
16
14
Live demo: [https://graphql-compose-mongoose.herokuapp.com/](https://graphql-compose-mongoose.herokuapp.com/)
@@ -97,7 +95,7 @@ export default graphqlSchema;
97
95
```
98
96
That's all!
99
97
You think that is to much code?
100
-
I don't think so, because by default internally was created about 30 graphql types (for input, sorting, filtering). So you will need much-much more lines of code to implement all this CRUD operations by hands.
98
+
I don't think so, because by default internally was created about 30 graphql types (for input, sorting, filtering). So you will need muchmuch more lines of code to implement all these CRUD operations by hands.
101
99
102
100
103
101
Customization options
@@ -106,7 +104,7 @@ When we convert model `const typeComposer = mongooseToTypeComposer(UserModel, cu
106
104
107
105
### Here is flow typed definition of this options:
108
106
109
-
This is top level of customization options. Here you setup name and description for main type, remove fields or leave only desired fields from mongoose model.
107
+
The top level of customization options. Here you setup name and description for the main type, remove fields or leave only desired fields.
110
108
```js
111
109
exporttypetypeConverterOpts= {
112
110
name?: string,
@@ -134,7 +132,7 @@ export type typeConverterInputTypeOpts = {
134
132
```
135
133
136
134
This is `opts.resolvers` level of options.
137
-
If you set option to `false` it will disable resolver or some of its input args.
135
+
If you set the option to `false` it will disable resolver or some of its input args.
138
136
Every resolver's arg has it own options. They described below.
139
137
```js
140
138
exporttypetypeConverterResolversOpts= {
@@ -184,6 +182,11 @@ export type typeConverterResolversOpts = {
This plugin add `connection` resolver. Build in mechanism allows sort by any unique indexes (not only by id). Also supported compound sorting (by several fields).
237
229
230
+
Besides standard connection arguments `first`, `last`, `before` and `after`, also added great arguments:
231
+
*`filter` arg - for filtering records
232
+
*`sort` arg - for sorting records
233
+
This plugin completely follows to [Relay Cursor Connections Specification](https://facebook.github.io/relay/graphql/connections.htm).
0 commit comments