Firestore定价;需要帮助来理解文档中的短语 [英] Firestore pricing; need help understanding a phrase in the document

查看:35
本文介绍了Firestore定价;需要帮助来理解文档中的短语的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Firestore帮助文档中碰到了以下短语,这让我感到困惑.

I came across the phrase below in Firestore help document which got me confused.

此外,如果侦听器断开连接超过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."

  1. 这是否意味着如果我在30分钟内断开监听器的连接并再次连接,那么在再次连接监听器后,我将不为读取费用付费?想象一下,如果我重新连接查询并再次在(change.type ==="added")中检索20个文档.

  1. Does this mean that if I disconnect a listener and connect again within 30 minutes, I won't be charged for reads after connecting listener again? Imagine if I reconnect query and retrieve 20 documents again in (change.type === "added").

db.collection("cities").where("state", "==", "CA")
    .onSnapshot(function(snapshot) {
        snapshot.docChanges.forEach(function(change) {

        //imagine 20 documents are fetched when I listen.
            if (change.type === "added") {
                console.log("New city: ", change.doc.data());
            }
 });
});

我感到困惑还是这个短语令人困惑?(或..我是否发现了漏洞?大声笑)

Am I confused or the phrase is confusing? (or.. have I found a loophole? lol)

推荐答案

选择断开连接并重新连接新侦听器并不会带来问题.问题是,如果听众成为并通过某些无法控制的方式断开连接,例如网络不可用.

The issue isn't wither you choose to disconnect the listener and reconnect a new one. The issue is if the listener becomes disconnected through some means out of your control, such as network unavailability.

请考虑一下,如果用户的设备处于可用性非常高且频繁出现的非常不稳定的连接上,那么查询可能会非常昂贵.重点是要承认,您不必为无法控制的条件付费.

Think about how expensive your query might be if the user's device is on a very spotty connection whose availability comes and goes frequently. The point is to acknowledge that you shouldn't have to pay for those conditions outside your control.

但是,如果您只是要重复查询数据库,那么您应该为此付费.

But if you're just going to repeatedly querying your database, well, you should be paying for that.

这篇关于Firestore定价;需要帮助来理解文档中的短语的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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