@@ -155,19 +155,19 @@ Suppose you `User` model has `friendsIds` field with array of user ids. So let b
155155``` js
156156UserTC .addRelation (
157157 ' friends' ,
158- () => ( {
159- resolver: UserTC .getResolver (' findByIds' ),
160- args : { // resolver `findByIds` has `_ids` arg, let provide value to it
158+ {
159+ resolver : () => UserTC .getResolver (' findByIds' ),
160+ prepareArgs : { // resolver `findByIds` has `_ids` arg, let provide value to it
161161 _ids : (source ) => source .friendsIds ,
162162 },
163163 projection: { friendsIds: 1 }, // point fields in source object, which should be fetched from DB
164- })
164+ }
165165);
166166UserTC .addRelation (
167167 ' adultFriendsWithSameGender' ,
168- () => ( {
169- resolver: UserTC .get (' $findMany' ), // shorthand for `UserTC.getResolver('findMany')`
170- args : { // resolver `findMany` has `filter` arg, we may provide mongoose query to it
168+ {
169+ resolver : () => UserTC .get (' $findMany' ), // shorthand for `UserTC.getResolver('findMany')`
170+ prepareArgs : { // resolver `findMany` has `filter` arg, we may provide mongoose query to it
171171 filter : (source ) => ({
172172 _operators : { // Applying criteria on fields which have
173173 // operators enabled for them (by default, indexed fields only)
@@ -179,7 +179,7 @@ UserTC.addRelation(
179179 limit: 10 ,
180180 },
181181 projection: { friendsIds: 1 , gender: 1 }, // required fields from source object
182- })
182+ }
183183);
184184```
185185### Reusing the same mongoose Schema in embedded object fields
0 commit comments