-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Error is thrown when base model's schema specifies options that are not reflected in discriminator model's schema #1818
Comments
+1 |
Same thing here, and agree with @flore2003... |
+1 |
I run into this too, +1 |
+1 |
It looks like such a behavior is only for a subset of options. Not all. |
|
Actually this looks like a dup of #3414, which means it should be fixed when 4.5 lands. |
Was this never fixed? Seeing this in 4.10.6. |
@ksloan this particular issue is fixed. If you're experiencing a similar issue, please open up a new issue with a repro script. |
fwiw, I see the same issue in 4.11.14 when my base schema options contains
Removing it makes the error go away (because now both schemas default to "__v" Perhaps my scenario is slightly different, but I don't understand how the original issue was fixed. |
When using the new discriminator models, mongoose throws an error, if the base model's schema specifies schema options that are not reflected in the discriminator model's schema.
Here is a simple code snippet that shows the issue:
The following error is thrown:
I understand that you can't set schema options on a schema used in a discriminator model, but it should not be an issue the other way around. I would expect the schema options of the base schema to be "inherited" by the discriminator schema.
The text was updated successfully, but these errors were encountered: