You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

结合Posts集合结构的Firestore读取计数计算问题咨询

数据结构
Posts ( collection )

⤷ Post_1 ( document )
  ⤷ post_id ( field )
  ⤷ post_description ( field )
  ⤷ category ( value = category_1 ) ( field )

⤷ Post_2 ( document )
  ⤷ post_id ( field )
  ⤷ post_description ( field )
  ⤷ category ( value = category_1 ) ( field )

⤷ Post_3 ( document )
  ⤷ post_id ( field )
  ⤷ post_description ( field )
  ⤷ category ( value = category_1 ) ( field )

⤷ Post_4 ( document )
  ⤷ post_id ( field )
  ⤷ post_description ( field )
  ⤷ category ( value = category_2 ) ( field )

⤷ Post_5 ( document )
  ⤷ post_id ( field )
  ⤷ post_description ( field )
  ⤷ category ( value = category_1 ) ( field )

⤷ Post_100 ( document )
  ⤷ post_id ( field )
  ⤷ post_description ( field )
  ⤷ category ( value = category_1 ) ( field )

⤷ Post_1000 ( document )
  ⤷ post_id ( field )
  ⤷ post_description ( field )
  ⤷ category ( value = category_2 ) ( field )

⤷ Post_5000 ( document )
  ⤷ post_id ( field )
  ⤷ post_description ( field )
  ⤷ category ( value = category_1 ) ( field )

⤷ Post_10000 ( document )
  ⤷ post_id ( field )
  ⤷ post_description ( field )
  ⤷ category ( value = category_2 ) ( field )

⤷ Post_15000 ( document )
  ⤷ post_id ( field )
  ⤷ post_description ( field )
  ⤷ category ( value = category_2 ) ( field )

⤷ Post_20000 ( document )
  ⤷ post_id ( field )
  ⤷ post_description ( field )
  ⤷ category ( value = category_2 ) ( field )

⤷ Post_25000 ( document )
  ⤷ post_id ( field )
  ⤷ post_description ( field )
  ⤷ category ( value = category_1 ) ( field )

⤷ Post_50000 ( document )
  ⤷ post_id ( field )
  ⤷ post_description ( field )
  ⤷ category ( value = category_2 ) ( field )
问题解答

问题1

Firestore 仅对实际获取文档的操作计入读取次数,创建文档、更新文档都属于写入操作,不会触发读取计数。
该场景中只有1次新增帖子的写入操作,和1次更新字段的写入操作,没有任何读取文档的行为,总读取次数为0。

问题2

Firestore 查询的读取次数按照实际返回的文档数量计算,和查询范围、过滤条件无关,每返回1篇文档计1次读取。
post_20000 到 post_20100 区间共包含 101 篇文档(首尾都计入),总读取次数为101。

问题3

和区间查询的计费逻辑一致,按查询返回的符合条件的文档总数计数。
已知 category_1 分类下共有13833篇帖子,查询会返回全部符合条件的文档,总读取次数为13833。

内容的提问来源于stack exchange,提问作者Taha Sami

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.01 17:54:03