@@ -26,7 +26,7 @@ This package uses [DataLoader](https://github.com/graphql/dataloader) for batchi
2626 - [ findOneById] ( #findonebyid )
2727 - [ findManyByIds] ( #findmanybyids )
2828 - [ findByFields] ( #findbyfields )
29- - [ Examples: ] ( #examples )
29+ - [ Examples] ( #examples )
3030 - [ deleteFromCacheById] ( #deletefromcachebyid )
3131
3232<!-- END doctoc generated TOC please keep comment here to allow auto update -->
@@ -246,35 +246,44 @@ Calls [`findOneById()`](#findonebyid) for each id. Resolves to an array of docum
246246
247247Resolves to an array of documents matching the passed fields.
248248
249- fields has type ` { [fieldName: string]: string | number | boolean | [string | number | boolean] } ` .
249+ ` fields ` has this type:
250250
251- #### Examples:
252-
253- ``` js
251+ ``` ts
252+ interface Fields {
253+ [fieldName : string ]:
254+ | string
255+ | number
256+ | boolean
257+ | ObjectId
258+ | (string | number | boolean | ObjectId )[]
259+ }
260+ ```
254261
255- // get user by username
256- // `collection.find({ username: $in: ['testUser'] })`
257- this .getByFields ({
258- username: ' testUser'
259- })
262+ #### Examples
260263
261- // get all users with either the "gaming" OR "games" interest
262- // `collection.find({ interests: $in: ['gaming', 'games'] })`
263- this .getByFields ({
264- interests: [' gaming' , ' games' ]
265- })
264+ ``` js
265+ // get user by username
266+ // `collection.find({ username: $in: ['testUser'] })`
267+ this .getByFields ({
268+ username: ' testUser'
269+ })
266270
267- // get user by username AND with either the "gaming" OR "games" interest
268- // `collection.find({ username: $in: ['testUser'], interests: $in: ['gaming', 'games'] })`
269- this .getByFields ({
270- username: ' testUser' ,
271- interests: [' gaming' , ' games' ]
272- })
271+ // get all users with either the "gaming" OR "games" interest
272+ // `collection.find({ interests: $in: ['gaming', 'games'] })`
273+ this .getByFields ({
274+ interests: [' gaming' , ' games' ]
275+ })
273276
277+ // get user by username AND with either the "gaming" OR "games" interest
278+ // `collection.find({ username: $in: ['testUser'], interests: $in: ['gaming', 'games'] })`
279+ this .getByFields ({
280+ username: ' testUser' ,
281+ interests: [' gaming' , ' games' ]
282+ })
274283```
275284
276285### deleteFromCacheById
277286
278287` this.deleteFromCacheById(id) `
279288
280- Deletes a document from the cache.
289+ Deletes a document from the cache that was fetched with ` findOneById ` or ` findManyByIds ` .
0 commit comments