Below is my firestore collection structure
My vue method to get data
fetchResults(){
db.collection(\'data\').onSnapshot((querySnapShot)=>{
Instead of calculating the data with an aggregate query, the data should be saved in the document itself using client side logic to update the aggregate data each time the document is changed or use cloud functions.
See this post from Google blog.
https://firebase.google.com/docs/firestore/solutions/aggregation