javascript - What exactly is regarded as 'document read' in Cloud Firestore?
问题描述
I did find some posts about how pricing is decided, but I want to make it as clear as possible.
Here's my document structure,
{
...
firstOption: "A",
secondOption: "B",
customerID: "1234",
...
}
I need to check if any of three conditions is met.
For example, if firstOption is "A", secondOption is "B", or customerID is "1234".
Since Firestore doesn't support OR
in where
cluase, my current plan is,
db.collection('').get().then(snapshot => snapshot.filter(doc => {
const {firstOption, secondOption, customerID} = doc.data();
if(firstOption === 'A' || secondOption === 'B' || customerID === '1234')
return true;
else
return false;
})
If three documents are returned, is it regarded as reading three documents or, since no where
clause is used to filter, reading the entire documents in the collection?
解决方案
如果您编写的客户端代码查询一个集合并且不过滤任何文档,它将读取该集合中的每个文档,以便客户端可以访问其所有快照。通常,如果查询与文档匹配,则将其计为读取。
推荐阅读
- python - 如何在熊猫数据框中重命名索引上方的列号 0
- c# - 在 MVC 中将文件从远程服务器传输到本地
- c++ - CPack NuGet 本机库
- amazon-web-services - 如何计算将文件从 S3 Standard-IA 传输到 S3 One Zone-IA 的成本
- php - 通过 PHP 将带有事件的页面标识符发送到 Google 分析
- php - .submit 上的 jQuery 检查数据库中是否存在登录并处理表单
- reactjs - 如果选择标签的数量是可变的,如何在选择标签中使用setsate更改值
- angular - 如何将对象传递给
从可观察? - java - 使用hibernate / postgres获取自动递增主键的问题
- mailchimp - Mailchimp 动态内容:在订阅电子邮件中添加自定义链接