Is there a method to iterate through all documents in a collection in firestore

前端 未结 2 1443
小蘑菇
小蘑菇 2021-02-20 01:45

I\'m using the firestore of firebase and I want to iterate through the whole collection. Is there something like:

db.collection(\'something\').forEach((doc) =>         


        
2条回答
  •  离开以前
    2021-02-20 02:29

    db.collection("cities").get().then(function(querySnapshot) {
        querySnapshot.forEach(function(doc) {
            // doc.data() is never undefined for query doc snapshots
            console.log(doc.id, " => ", doc.data());
        });
    });
    

提交回复
热议问题