小编Cha*_*Jie的帖子

如何减少 Firestore 的文档读取

我正在将 Firestore (我是新手)用于小型 Web 应用程序。目前,每次刷新或转到另一个页面时,该函数都会检索 Firestore 中的所有文档。但它检索的数据不会经常改变,

有没有一种方法可以让我检索所有数据,而无需阅读任何文档?

我目前正在使用这些函数来检索数据

firebase
.firestore()
.collection("products")
.then((snapshot) => {
       snapshot.forEach((docs) => {
       });
});



firebase
.firestore()
.collection("products")
.where("prodID", "==", prodID)
.then((snapshot) => {
       snapshot.forEach((docs) => {
       });
});
Run Code Online (Sandbox Code Playgroud)

javascript nosql firebase google-cloud-functions google-cloud-firestore

5
推荐指数
1
解决办法
2874
查看次数