Will cost only getting the size of a collection of 1000 docs as 1000 read?

寵の児 提交于 2021-02-11 14:02:27

问题


I am confused about Cloud firestore cost. I want to get the size of a collection of 1000 docs, and I am not reading every doc data, so will it cost me as 1000 read or 1 read?

db.collection(`users/${user}/followers`)
.get().catch(onErr).then(followers=> {
  console.log('followers length: ', followers.size);
});

I have 1000 docs in followers collection, so as you can see I am only reading the length of collection, so how much will cost me ?? 1000 read or 1 read?


回答1:


If in the followers collection you have 1000 document then it will cost you 1000 reads. Here you are attaching the method get() which retrieves all the documents in a collections



来源:https://stackoverflow.com/questions/61367032/will-cost-only-getting-the-size-of-a-collection-of-1000-docs-as-1000-read

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!