-
Notifications
You must be signed in to change notification settings - Fork 95
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
Mongoose query aggregation #212
Comments
I don't think there is, as it strays too far from the "unified query system"(or whatever it's called, please correct me), You could extend/override the find/_find functions to customize this to your will though. |
@Aranad I've created custom services that use aggregation underneath. Or if you need an aggregation in addition to other data from a service you could add an after hook that does the aggregation as well. |
@corymsmith that sounds awesome... could you point me in the right direction to read up on and implement that, thanks! :-) |
maybe try putting the params in params.mongoose |
@Aranad Theres some info here on creating a custom service, unfortunately my custom service is proprietary so I can't share it: https://docs.feathersjs.com/api/services.html |
I figured out a way to do it from the before.find hook. hook.service.Model is the mongoose model object that has aggregate() available, so I made a convention for passing aggregate data in find() which the hook can detect and divert to the aggregate method :-) |
Perfect! |
Glad it worked! Closing this one then. |
@Aranad how exactly do you accomplish this, do you have some example? |
@stalinb87 yes I documented how I did it here: https://www.organicdesign.co.nz/Our_SPA#Database_schemas_and_querying, a similar method could also be done with the hook creating the complex query server-side instead of the whole aggregation query structure being passed from client to server. |
You can override |
Example aggregate for
|
Is there any way to use the Mongo/Mongoose collection aggregation-pipline from feathers-mongoose?
The text was updated successfully, but these errors were encountered: