Skip to content

Commit 1bf65f7

Browse files
yoadsnnodkz
authored andcommitted
docs(README): Update filter operators usage docs
- Fixed the usage example of the `filter` field with operators - Clarified some documentation about the defaults of the operators filtering feature
1 parent 3ebcbb0 commit 1bf65f7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,11 @@ UserTC.addRelation(
144144
resolver: UserTC.get('$findMany'), // shortand for `UserTC.getResolver('findMany')`
145145
args: { // resolver `findMany` has `filter` arg, we may provide mongoose query to it
146146
filter: (source) => ({
147-
_id: { $in: source.friendsIds },
148-
age: { $gt: 21 },
147+
_operators : { // Applying criteria on fields which have
148+
// operators enabled for them (by default, indexed fields only)
149+
_id : { in: source.friendsIds },
150+
age: { gt: 21 }
151+
},
149152
gender: source.gender,
150153
}),
151154
limit: 10,
@@ -258,6 +261,7 @@ export type filterHelperArgsOpts = {
258261
onlyIndexed?: boolean, // leave only that fields, which is indexed in mongodb
259262
requiredFields?: string | string[], // provide fieldNames, that should be required
260263
operators?: filterOperatorsOpts | false, // provide filtering fields by operators, eg. $lt, $gt
264+
// if left empty - provides all oeprators on indexed fields
261265
};
262266

263267
// supported operators names in filter `arg`

0 commit comments

Comments
 (0)