Conflict between doc example and type declaration for query middleware #10531
Labels
docs
This issue is due to a mistake or omission in the mongoosejs.com documentation
typescript
Types or Types-test related issue / Pull Request
Milestone
Do you want to request a feature or report a bug?
Not sure. Read below.
What is the current behavior?
Doc example reads
this.model
in query middleware (https://mongoosejs.com/docs/middleware.html#notes),This does work in practice. However, in typescript, this raises error indicating 'Property "model" not exist in Query...' (with
this
specified as typeQuery<any, any>
)The example is somewhat confusing though because query does has
findOne
method, what is the point readingthis.model
?If the current behavior is a bug, please provide the steps to reproduce.
Not sure if this is a spot needs to be updated in doc example or something missed in type declaration.
What is the expected behavior?
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
Node v12.22.1
Mongoose v5.13.3
The text was updated successfully, but these errors were encountered: