How can I efficiently retrieve the top 10 products with the best average ratings in Cloud Firestore, given that I have product, review, and user collections?
From what I understand, Firestore doesn't support SQL-style GROUP BY queries, so I'm not sure how to aggregate ratings efficiently. Calculating this client-side also doesn't seem safe or scalable.
Should I store pre-aggregated ratings in Firestore for each product using Cloud Functions, or are there other more efficient ways to handle this type of aggregation? How can I ensure that the top 10 products are calculated efficiently without overloading Firestore with heavy queries? Any suggestions on the best approach?