Skip to content

Commit 5d388b3

Browse files
committed
README.md
1 parent 6f3f727 commit 5d388b3

File tree

1 file changed

+16
-20
lines changed

1 file changed

+16
-20
lines changed

README.md

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
graphql-compose-mongoose
22
======================
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`.
54

65
Installation
76
============
@@ -10,7 +9,6 @@ npm install graphql graphql-compose graphql-compose-connection mongoose graphql-
109
```
1110
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.
1211

13-
1412
Example
1513
=======
1614
Live demo: [https://graphql-compose-mongoose.herokuapp.com/](https://graphql-compose-mongoose.herokuapp.com/)
@@ -97,7 +95,7 @@ export default graphqlSchema;
9795
```
9896
That's all!
9997
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 much much more lines of code to implement all these CRUD operations by hands.
10199

102100

103101
Customization options
@@ -106,7 +104,7 @@ When we convert model `const typeComposer = mongooseToTypeComposer(UserModel, cu
106104

107105
### Here is flow typed definition of this options:
108106

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.
110108
```js
111109
export type typeConverterOpts = {
112110
name?: string,
@@ -134,7 +132,7 @@ export type typeConverterInputTypeOpts = {
134132
```
135133

136134
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.
138136
Every resolver's arg has it own options. They described below.
139137
```js
140138
export type typeConverterResolversOpts = {
@@ -184,6 +182,11 @@ export type typeConverterResolversOpts = {
184182
count?: false | {
185183
filter?: filterHelperArgsOpts | false,
186184
},
185+
connection?: false | {
186+
uniqueFields: string[],
187+
sortValue: mixed,
188+
directionFilter: (<T>(filterArg: T, cursorData: CursorDataType, isBefore: boolean) => T),
189+
};
187190
};
188191
```
189192

@@ -219,22 +222,15 @@ export type limitHelperArgsOpts = {
219222
};
220223
```
221224

222-
What's next?
225+
Used plugins
223226
============
224-
Read about [graphql-compose](https://github.com/nodkz/graphql-compose).
225-
This module in near future allow to combine any complexity of your GraphQL schema.
226-
- From different data-sources, eg. `Mongoose`, `Sequelize`, some RESTfull APIs.
227-
- Restrict access to fields due context.
228-
- Wraps any resolver with additional business logic.
229-
- Relate different type with each other (build graph).
230-
- Prepare schemas for `Relay` (adds clientMutationId, node interface, generate global ids)
231-
- Add caching via `DataLoader`
232-
- Add supporting of GraphQL Connection Type
233-
- And may be using graphql on server side for API calls to different services (have such amazing thoughts ;).
234-
- and much much more
235-
236-
## SO, THE FUTURE OF CRAZY GRAPHQL SCHEMAS IS NOT SO FAR
227+
### [graphql-compose-connection](https://github.com/nodkz/graphql-compose-connection)
228+
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).
237229

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).
238234

239235
TODO
240236
====

0 commit comments

Comments
 (0)