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
I have searched existing issues to ensure the bug has not already been reported
Mongoose version
8.1.0
Node.js version
18.18.0
MongoDB server version
7.0.5
Typescript version (if applicable)
No response
Description
Mongoose populates the virtual internally (set() is never called with the populated value), but additionally calls its setter function with the value undefined. This can lead to bad, unexpected side effects.
I'm not sure whether that is expected behavior, but if so, please advise on how we should implement the below use case.
Steps to Reproduce
Example script which outputs a person with userId: null and userType: null.
vkarpov15
added
confirmed-bug
We've confirmed this is a bug in Mongoose and will fix it.
and removed
has repro script
There is a repro script, the Mongoose devs need to confirm that it reproduces the issue
labels
Jan 27, 2024
Prerequisites
Mongoose version
8.1.0
Node.js version
18.18.0
MongoDB server version
7.0.5
Typescript version (if applicable)
No response
Description
Mongoose populates the virtual internally (
set()
is never called with the populated value), but additionally calls its setter function with the valueundefined
. This can lead to bad, unexpected side effects.I'm not sure whether that is expected behavior, but if so, please advise on how we should implement the below use case.
Steps to Reproduce
Example script which outputs a person with
userId: null
anduserType: null
.Expected Behavior
The populated field (i.e.
person
) to be populated and the setter not to be called or called with the value that was populated.The text was updated successfully, but these errors were encountered: