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
According to Mongoose documentation ref function should be called for every populate() call to determine the field's model according to the current document dynamically.
But in the current scenario, the ref is called only once during initialization and uses that fixed return value for the rest of populate calls.
Is there an existing issue for this?
Current behavior
ref
function passed in schema options is being overridden by the static return value of that function during schema initialization.Minimum reproduction code
https://codesandbox.io/p/sandbox/confident-antonelli-m7js5d
Steps to reproduce
No response
Expected behavior
According to Mongoose documentation
ref
function should be called for everypopulate()
call to determine the field's model according to the current document dynamically.But in the current scenario, the ref is called only once during initialization and uses that fixed return value for the rest of populate calls.
Package version
10.0.0
mongoose version
7.3.1
NestJS version
No response
Node.js version
16
In which operating systems have you tested?
Other
mongoose/lib/factories/definitions.factory.ts
Lines 97 to 98 in bbc84df
ref in schema options is being overridden here
The text was updated successfully, but these errors were encountered: