![](/img/trans.png)
[英]How to check all documents in a collection for a value firestore reactjs
[英]How to access documents properties from collection firestore. reactjs
這是我的代碼:
const posts = firestore.collection("posts");
function myFunc() {
posts.get().then((result) => {
result.docs.forEach((post) => {
console.log(post.poster);
})
})
}
當我運行此 function 時,當在實際文檔中將海報屬性設置為字符串變量時,它會為每個文檔記錄 undefined 。
試試:console.log(post.data().poster)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.