Skip to content

Commit 946c5d7

Browse files
committed
Add info about filtering with operators to readme
1 parent d1a33fa commit 946c5d7

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
## master
2+
* add support for filtering with operators $gt, $gte, $lt, $lte, $ne, $in, $nin
23

34
## 0.0.6 (July 08, 2016)
45
* rename `input` argument to `record` for mutations (due `graphql-compose-relay` compatibility).

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This is a plugin for [graphql-compose](https://github.com/nodkz/graphql-compose)
44

55
Example
66
=======
7-
Live demo: [https://graphql-compose-mongoose.herokuapp.com/](https://graphql-compose-mongoose.herokuapp.com/?query=%7B%0A%20%20userMany(limit%3A%205)%20%7B%0A%20%20%20%20_id%0A%20%20%20%20name%0A%20%20%20%20age%0A%20%20%7D%0A%7D)
7+
Live demo: [https://graphql-compose-mongoose.herokuapp.com/](https://graphql-compose-mongoose.herokuapp.com/)
88

99
Source code: https://github.com/nodkz/graphql-compose-mongoose-example
1010

@@ -186,8 +186,13 @@ export type filterHelperArgsOpts = {
186186
isRequired?: boolean, // set `filter` arg as required (wraps in GraphQLNonNull)
187187
onlyIndexed?: boolean, // leave only that fields, which is indexed in mongodb
188188
requiredFields?: string | string[], // provide fieldNames, that should be required
189+
operators?: filterOperatorsOpts | false, // provide filtering fields by operators, eg. $lt, $gt
189190
};
190191

192+
// supported operators names in filter `arg`
193+
export type filterOperatorNames = 'gt' | 'gte' | 'lt' | 'lte' | 'ne' | 'in[]' | 'nin[]';
194+
export type filterOperatorsOpts = { [fieldName: string]: filterOperatorNames[] | false };
195+
191196
export type sortHelperArgsOpts = {
192197
sortTypeName?: string, // type name for `sort`
193198
};
@@ -223,7 +228,7 @@ This module in near future allow to combine any complexity of your GraphQL schem
223228

224229
TODO
225230
====
226-
- [ ] for `filter` arg add support for $lt, $gt and other selector's operators
231+
- [ ] for `filter._operators` arg add support for $regexp
227232

228233
[CHANGELOG](https://github.com/nodkz/graphql-compose-mongoose/blob/master/CHANGELOG.md)
229234

0 commit comments

Comments
 (0)