简体   繁体   English

如何从 Firestore 获取多个文档

[英]How can i get multiple documents from the firestore

Hi I want to get multiple documents from the firestore.嗨,我想从 Firestore 获取多个文档。

var docBookingRef = firestore().collection('timeSlot');
docData.forEach((item) => {
    docBookingRef.where('docId', '==', item);
});
docBookingRef.get().then((doc) => {
    doc.forEach(function(docV) {
        console.log("Slot data", docV.data());

    });
})

docData contains ids of all list. docData 包含所有列表的 id。 I am not getting any list from the above code.我没有从上面的代码中得到任何列表。

I have barely used React and never used Firebase, but after using a where you might inmediately want to use the get() ( where returns a new query object and the get() retrieves the info, as Frank van Puffelen clarified)我几乎没有使用过 React,也从未使用过 Firebase,但是在使用where你可能想要立即使用get()的地方之后( where返回一个新查询 object 并且get()检索信息,正如Frank van Puffelen澄清的那样)

docData.forEach((item)=>{
   firestore().collection('timeSlot')
              .where('docId','==', item)
              .get()
              .then(function(doc) {
                     doc.forEach(function(docV) {
                         console.log("Slot data", docV.data());
                     });
              });
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从 Firestore 获取当前用户的文档? - How can I get documents from Firestore for current user? 我无法从 FireStore 打印多个文档 - I can't print multiple documents from FireStore 如何在FIRESTORE中将多个数据输入文档 - How can i enter multiple data into documents in FIRESTORE 如何从 Cloud Firestore 检索多个文档,但没有重复? - How do i retrieve multiple documents from cloud firestore, but no duplicates? 如何从 firebase firestore 异步获取所有父 collections 的所有文档? - How can I get all the documents of a all parent collections asynchronously from firebase firestore? 如何从Firestore获取没有元数据的文档 - How to get documents without metadata from firestore 无法从 FIRESTORE 的集合中获取多个文档 - UNABLE TO Get multiple documents from a collection FROM FIRESTORE 我可以使用 Promise.all 同时从 Firestore 获取一些文件吗? - can I get some documents from firestore simultaneously using Promise.all? Firestore - 如何确定地从集合中获取多个随机(非重复的、特定数量的)文档? - Firestore - How to get multiple random (non duplicated, specific number of) documents from a collection with certainty? 我可以获取所有文档,但无法在 Firestore 中检索单个文档 - I can get all documents but unable to retrieve single document in Firestore
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM