Firestore query documents with only collections inside

后端 未结 2 1775
不思量自难忘°
不思量自难忘° 2021-01-22 19:59

I have a firestore collection which has some documents inside it. The documents contains only collections not any fields. So when I try to get all documents inside the root coll

2条回答
  •  借酒劲吻你
    2021-01-22 20:11

    Adapted from Get Data with Cloud Firestore

    db.collection("transactions").doc("2018-01-02").collection("education-1").get()
        .then(function(querySnapshot) {
            querySnapshot.forEach(function(doc) {
                // doc.data() is never undefined for query doc snapshots
                console.log(doc.id, " => ", doc.data());
            });
        })
        .catch(function(error) {
            console.log("Error getting documents: ", error);
        });
    

提交回复
热议问题