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
Dynamic ref functions do not appear to work in @nestjs/mongoose. The ref function appears to be resolved at the time the schema is created, instead of at runtime.
This makes resolving the type for an array of embedded discriminators difficult in deeply nested or dynamic data structures where refPath may not be suitable.
The schema should not resolve a ref function's return at the time of its creation, but allow them to be run at runtime so the behaviour is the same as that of Mongoose.
The reproduction repository shows the difference of behaviour between this module and plain Mongoose and asserts this with integration tests for the two.
Package version
10.0.6
mongoose version
8.4.4
NestJS version
10.3.10
Node.js version
18.20.3, 20.15.0
In which operating systems have you tested?
macOS
Windows
Linux
Other
No response
The text was updated successfully, but these errors were encountered:
Is there an existing issue for this?
Current behavior
Dynamic
ref
functions do not appear to work in@nestjs/mongoose
. The ref function appears to be resolved at the time the schema is created, instead of at runtime.This has been reported in the past here: #1847
This makes resolving the type for an array of embedded discriminators difficult in deeply nested or dynamic data structures where
refPath
may not be suitable.Minimum reproduction code
https://github.com/kiyui/nestjs-mongoose-ref-issue-reproduction
Steps to reproduce
See the proof of work section in the reproduction repository.
Expected behavior
The schema should not resolve a
ref
function's return at the time of its creation, but allow them to be run at runtime so the behaviour is the same as that of Mongoose.The reproduction repository shows the difference of behaviour between this module and plain Mongoose and asserts this with integration tests for the two.
Package version
10.0.6
mongoose version
8.4.4
NestJS version
10.3.10
Node.js version
18.20.3, 20.15.0
In which operating systems have you tested?
Other
No response
The text was updated successfully, but these errors were encountered: