You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What is the expected behavior?
TypeScript should recognize the query helper on findOneAndUpdate and related queries.
I believe this is happening because findOneAndUpdate and fingByIdAndUpdate return the Query type instead of the QueryWithHelpers type that other find queries return:
I apologize if this is intended behavior that I'm just not understanding.
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
Node.js v14.16.1
TypeScript 4.2.4
Mongoose 6.0.3
MongoDB 4.1.1
Thanks in advance!
The text was updated successfully, but these errors were encountered:
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
TypeScript does not recognize my custom Query Helpers on
findOneAndUpdate
andfindByIdAndUpdate
queries.If the current behavior is a bug, please provide the steps to reproduce.
Adapted from the example here: https://mongoosejs.com/docs/typescript/query-helpers.html.
I am trying to make a query helper to lean the results of a query with virtuals. The query helper works correctly for other
find
queries.tsconfig.json
:What is the expected behavior?
TypeScript should recognize the query helper on
findOneAndUpdate
and related queries.I believe this is happening because
findOneAndUpdate
andfingByIdAndUpdate
return theQuery
type instead of theQueryWithHelpers
type that otherfind
queries return:mongoose/index.d.ts
Line 949 in 0c69e9b
I apologize if this is intended behavior that I'm just not understanding.
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
Node.js
v14.16.1
TypeScript
4.2.4
Mongoose
6.0.3
MongoDB
4.1.1
Thanks in advance!
The text was updated successfully, but these errors were encountered: