Reusing schema with discriminated field fails with "discriminator already exists" error #14162
Closed
2 tasks done
Labels
confirmed-bug
We've confirmed this is a bug in Mongoose and will fix it.
Milestone
Prerequisites
Mongoose version
7.6.7
Node.js version
18.16
MongoDB server version
6.0.5
Typescript version (if applicable)
No response
Description
I am not sure I caught the minimal scenario where this issue occurs, but it seems that reusing a schema object that contains a discriminated field causes an error. Defining an exact duplicate of the schema does not cause this error.
Steps to Reproduce
Expected Behavior
Code should run without errors.
The text was updated successfully, but these errors were encountered: