[英]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.