-
-
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
schema.recompileSchema exception when subDocument discriminator is defined before the model is compiled #14527
Closed
2 tasks done
Labels
confirmed-bug
We've confirmed this is a bug in Mongoose and will fix it.
Milestone
Comments
vkarpov15
added
has repro script
There is a repro script, the Mongoose devs need to confirm that it reproduces the issue
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
Apr 24, 2024
Fixed by 23869fb, I got my issue numbers mixed up |
This was referenced May 21, 2024
This was referenced May 21, 2024
Merged
This was referenced May 21, 2024
This was referenced Jun 7, 2024
This was referenced Jun 9, 2024
This was referenced Jun 12, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Prerequisites
Mongoose version
8.3.1
Node.js version
18.16
MongoDB server version
6.3.0
Typescript version (if applicable)
No response
Description
The following example throws "discriminator with name 'X' already exists" when the model of the top level schema is compiled after the discriminator definitions have been created on the subdocument schema.
If you create the model first, recompile seems to work as expected.
Important to note that on either case, the schema behaves as expected without recompiling.
Steps to Reproduce
Expected Behavior
The schema should recompile without error.
The text was updated successfully, but these errors were encountered: