如何在Firebase Cloud Firestore中更新子集合

时间:2020-05-16 14:01:17

标签: firebase google-cloud-firestore

这是我的代码,我无法通过不在数据库中获取所有帖子来更新用户发表的评论

db.collection('posts').get().then(querySnapShot=>{
            querySnapShot.docs.forEach(doc=>{
          db.collection('posts').doc(doc.id).collection('comments').where('uid','==',sponse.uid).get().then(
              querySnapShot=>{
                  querySnapShot.docs.forEach(doc2=>{
                      db.collection('posts').doc(doc.id).collection('comments').doc(doc2.id).update({
                          profilePic:remoteUri
                      })
                  })
              }
          )
            })
        })

0 个答案:

没有答案