Skip to content
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

Open
kevindente opened this issue Nov 26, 2013 · 11 comments
Open

Automatically including discriminator in criteria #20

kevindente opened this issue Nov 26, 2013 · 11 comments
Assignees

Comments

@kevindente
Copy link

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.

@chopachom
Copy link
Contributor

+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']

@sanbor
Copy link

sanbor commented Jan 22, 2014

+1 this is a must have.

If I don't want to use discriminator I could just use the parent model.

Example: Vehicle.find to match all vehicles, and Car.find to match only Vehicles with discriminatorKey === 'Vechicle'.

@Oleg2tor
Copy link

+1

@bloudermilk
Copy link

This would be great.

@lucadom
Copy link

lucadom commented Feb 19, 2014

+1

@bobmoff
Copy link

bobmoff commented Nov 23, 2014

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.

@miguelcobain
Copy link

Definitely +1

@langfors
Copy link

langfors commented Feb 2, 2015

Pretty please +1

@bobmoff
Copy link

bobmoff commented Feb 9, 2015

Here is a fork with this: https://github.com/okpanda/mongoose-schema-extend

@israelcrux
Copy link

@bobmoff I moved to okpanda's. This one is really dead. Thanks for sharing!

@sieira
Copy link
Collaborator

sieira commented Nov 11, 2015

Will check it soon

@sieira sieira self-assigned this Nov 11, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests