Google Cloud Firestore控制台读取所有文档和费用 [英] Google Cloud Firestore console reading of all documents and charges

查看:63
本文介绍了Google Cloud Firestore控制台读取所有文档和费用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Firestore的新手,所以我有一个个人档案"和用户"收藏集.在Cloud Firestore控制台中,当我单击数据库> Firestore>数据选项卡>配置文件或>用户时,该控制台正在读取每个集合中的所有文档.这些读取计数在用法"选项卡中.所以我的问题是,如果我在个人档案"集合中说50万个文档,然后单击数据",我将被收取阅读50万个文档的费用,仅查看前25个文档.只需单击数据"选项卡,控制台即可读取第一个集合的所有文档.

I am new to Firestore so I have a Profiles and Users collections. In the Cloud Firestore Console when I click on Database > Firestore > Data tab > Profiles or > Users the console is reading ALL the documents in each collection. These reads are counted in the Usage tab. So my question is if I have lets say 500K documents in the Profiles collection and clicked on Data I will be charged for reading 500K docs just to view the first 25 docs only. Just clicking on Data tab the console reads all the docs of the first Collection.

我尝试使用过滤器,但要使用它,您必须先单击收藏夹"并先阅读所有文档,然后才能编辑过滤器.

I tried using the filter but to use it you will have to click on the Collection and read all the docs first then you can edit the filter.

这是它的工作方式还是我的误解?

Is this the way it works or is it my misunderstanding?

推荐答案

我前段时间也遇到了同样的困惑,在深入研究这个问题后,我了解到所有加载到数据"标签中的数据的Firestore页面确实计入整个Firestore的使用情况.

I faced the same confusion a while ago and upon digging down to the issue I learnt that all the data which gets loaded in the 'Data' tab of Firestore page does count towards the overall Firestore usage.

但是,我担心的是与您相同的问题,因此我联系了Firebase支持.他们回过头来确认我的第一个本能(数据"选项卡中的文档读取确实算在内)但最初,它仅读取任何选定集合中的前300个文档,因此即使您的集合中有超过100万个文档,它也会仍然只加载前300个文档.

However, I was concerned with the same question as yours thus I contacted Firebase support. They reverted back confirming the first instinct of mine(Document reads in 'Data' tab does count) BUT initially it reads only the first 300 documents of ANY selected collection, so even if your collection has over 1 million docs, it will still load only the first 300 documents.

他们提出了解决方法,直到Firebase团队找到合法解决方案

They suggested a way around it until the Firebase team finds a legit solution

  1. 在Firestore页面的用法标签上添加书签. (因此,您基本上可以跳过"数据"标签,并且无用的300次读取操作)
  2. 以某种方式添加一个虚拟集合,以确保它是默认情况下在Firestore页面上默认加载的第一个集合(按字母顺序).
  1. Bookmarking the Usage tab of the Firestore page. (So you basically 'Skip' the Data Tab and the useless 300 reads)
  2. Adding a dummy collection in a certain way that ensures it is the first collection(alphabetically) which gets loaded by default on the Firestore page.

这篇关于Google Cloud Firestore控制台读取所有文档和费用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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