Caution to pass argument QueryOptions
by reference
#12176
Labels
confirmed-bug
We've confirmed this is a bug in Mongoose and will fix it.
Milestone
Prerequisites
Mongoose version
6.4.6
Node.js version
17.7.1
MongoDB server version
5x
Description
find
method implicitly overrides arguments passed by referenceBug has been raised originally on nestjs/nest#10045 but once I found the root case, it looks like it is related to mongoose.
Steps to Reproduce
Given object
Once query is execuded, the
queryOptions
became{}
.Expected Behavior
queryOptions
variable should not be overriden or should be properly documented here: https://mongoosejs.com/docs/api.html#query_Query-setOptionsThe text was updated successfully, but these errors were encountered: