When you use a TC's findMany resolver multiple times in schema, for example, first to add a relation, then to add a findMany query, and then to add a pagination query:
X.addRelation('y', {
resolver: X.mongooseResolvers.findMany({filter: filterOptions1})
}),
schemaComposer.Query.addFields({
xFindMany: X.mongooseResolvers.findMany({filter: filterOptions2}),
xPaginate: X.mongooseResolvers.paginate({
findManyOpts: {filter: filteroptions3}
})
});
Then xFindMany and xPaginate queries will use filterOptions1, but not filterOptions2 or filterOptions3.
It seems that by default the generated filter input type for all the findMany resolvers of the same model share the same name, so the type is created for the first findMany, and reused for all other ones. If this default behavior can't be changed, it would be nice to at least have a run time warning and/or FAQ entry in documentation about the limitation.
When you use a TC's
findManyresolver multiple times in schema, for example, first to add a relation, then to add afindManyquery, and then to add apaginationquery:Then
xFindManyandxPaginatequeries will usefilterOptions1, but notfilterOptions2orfilterOptions3.It seems that by default the generated filter input type for all the
findManyresolvers of the same model share the same name, so the type is created for the firstfindMany, and reused for all other ones. If this default behavior can't be changed, it would be nice to at least have a run time warning and/or FAQ entry in documentation about the limitation.