-
Notifications
You must be signed in to change notification settings - Fork 45
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
Automatically including discriminator in criteria #20
Comments
+1, it actually should save the whole inheritance chain to discriminator key to work properly, so if we have a car it should include something like ['Vehicle', 'Car'] |
+1 this is a must have. If I don't want to use discriminator I could just use the parent model. Example: |
+1 |
This would be great. |
+1 |
Just bumped in to the same problem. Kind of loosing the point of extending if I have to manually add the _type property to all queries. So: +1 These comments are almost a year old so I guess the hope for a fix is tiny. |
Definitely +1 |
Pretty please +1 |
Here is a fork with this: https://github.com/okpanda/mongoose-schema-extend |
@bobmoff I moved to okpanda's. This one is really dead. Thanks for sharing! |
Will check it soon |
One thing that threw me about using this plugin is that querying from a derived model doesn't automatically scope the query to the type identified by the discriminator key. So if Car extends Vehicle, Car.find() includes all Vehicles, not just cars. Have you considered patching queries to include the filter automatically? Or alternatively, provide special finder methods that scope a query to the specific type.
The text was updated successfully, but these errors were encountered: