You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to figure out how to calculate the average rating for a review.
my review model has a rating field, its an array of objects that looks like:
The hook solution looks fine to me (definitely easier than trying to figure out the right MongoDB query for this, it is database agnostic and probably not any slower). As long as you make sure the Mongoose model gets converted to an object before modifying the result I don't see a problem with this.
Hey,
I'm trying to figure out how to calculate the average rating for a review.
my review model has a rating field, its an array of objects that looks like:
How do I calculate the average of communication/value/accuracy using feathers-mongoose?
Here's my solution not using mongoose (Its in the after hooks)
The text was updated successfully, but these errors were encountered: