我正在尝试从数据库层次结构db.collection / doc / collection /中获取数据
javascript - 获取Cloud Firestore数据库集合-LMLPHP

我需要从“产品”集合中获取数据

通过使用此代码段,我已经可以过滤出正确的文档。
仍然没有设法从下一个集合中获取任何数据。

db.collection('deliveryservice').where('owner_id', '==', user.uid).collection('product').get().then((snapshot) => {
        snapshot.docs.forEach(doc => {

最佳答案

请尝试以下方式从您的product集合中检索数据。

var docRef = db.collection("deliveryservice").doc(user.uid).collection('product');

docRef.get().then((snapshot) => {
    snapshot.docs.forEach(doc => {
    }
}).catch(function(error) {
    console.log("Error getting document:", error);
})

关于javascript - 获取Cloud Firestore数据库集合,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/57556168/

10-09 23:41
查看更多