Firestore Group by field

前端 未结 3 1535
甜味超标
甜味超标 2021-01-25 23:19

Below is my firestore collection structure

My vue method to get data

fetchResults(){
  db.collection(\'data\').onSnapshot((querySnapShot)=>{
         


        
3条回答
  •  长发绾君心
    2021-01-26 00:00

    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

提交回复
热议问题