-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
methods defined on the Object/Array prototype throws error when mongoose.populate() is used #9876
Comments
Array doesn't create a problem but Object does. |
Yes you are right, It is methods defined on the Object prototype, |
If they said they fixed it then they reintroduced the same bug in 15.7 |
Nope, it is fixed, I am using 15.7 |
We will be looking into this. Thank you for the report. |
Do you want to request a feature or report a bug?
bug
What is the current behavior?
So I have a library in my project that defines a method on the prototype of Array and Object in node.js environment.
All mongoose api works fine, util I call populate() on them, then it throws an error like this:
in above example the method defined on prototype is called "reach", thus you see: "OperationSessionInfo.lsid.reach"
If the current behavior is a bug, please provide the steps to reproduce.
Just define a method on the prototype of Object and Array in node, and then try to run a query like this:
SomeCollection.find({id: "some id"}).populate("some_field")
What is the expected behavior?
It should not throw error. Defining a method on the prototypes of Javascript is a valid action and should not conflict with mongoose methods.
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
Node: 15.7
mongoose: 5.11.14
The text was updated successfully, but these errors were encountered: