用于查询的Firebase Firestore定价 [英] Firebase firestore pricing for querying

查看:87
本文介绍了用于查询的Firebase Firestore定价的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我在一个集合中有20个文档,并且每个文档都有一个包含要查询的视图数的字段.下面的示例

Assume that i have 20 documents in a collection, and each document has a field that contains the number of views for querying. Example below

collection
     |_document
             |_views: 100
     |_document
             |_views: 600
     |_document
             |_views: 10

稍后,我查询文档以返回前5个最高的视图.现在我的问题是,我将被收取20次文档阅读或5次文档阅读

Later i query the documents to return top 5 highest views. Now my question is, will i be charged for 20 document reads or 5 document reads

推荐答案

此Firestore文档项目(收听查询结果"部分)将为您提供答案:

This Firestore documentation item (Section "Listening to query results") will give you the answer:

当您侦听查询结果时,每次在结果集中添加或更新文档时,您都要付费.当文档从结果集中删除时,由于文档已更改,您还需要为阅读付费. (相反,删除文档后,您无需支付阅读费用.)

When you listen to the results of a query, you are charged for a read each time a document in the result set is added or updated. You are also charged for a read when a document is removed from the result set because the document has changed. (In contrast, when a document is deleted, you are not charged for a read.)

此外,如果侦听器断开连接超过30分钟(对于 例如,如果用户离线),您将被收取以下费用: 如果您发出了全新的查询.

Also, if the listener is disconnected for more than 30 minutes (for example, if the user goes offline), you will be charged for reads as if you had issued a brand-new query.

换句话说,如果您的查询将返回的文档数限制为5(例如使用limit(),如

In other words, if your query limits the number of documents returned to 5 (e.g. with limit(), as explained here), you will only pay for 5 document reads (unless you are using a listener -and not get()- and a document is created/modified/deleted and changes the top 5 or unless you encounter the 30 minutes disconnection specific case mentioned above).

另一方面,如果您在客户端过滤掉前5个文档,则在收到整个文档集之后,显然会向您收取全套费用.

On the other hand, if you filter the top 5 docs on the client-side, after receiving the entire set of documents, you will obviously be charged for the full set.

这篇关于用于查询的Firebase Firestore定价的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆