I have a product
collection. For every product a user can leave a review with a 5-star rating which is stored in a reviews
collection.
I’m now trying to get the average rating for every product in my collection. To accomplish this, should I keep an average_rating
field on my product
and update it every time a new review
is created or is there a special way to handle “calculated” fields?
If this is the way to do it, is there a way to use abac to handle this? Since I don’t want users to be able to set the average_rating
of a product to just anything.