Firestore docRef.Collections(ctx)的读/写成本是多少? [英] What is the read/write cost for Firestore docRef.Collections(ctx)?

查看:42
本文介绍了Firestore docRef.Collections(ctx)的读/写成本是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在跟踪HTTP服务层功能的读写成本.

I am tracking the read/write cost of my HTTP service layer functions.

我是否更正Collection/Doc/Collection/Doc链不会读取任何内容?

Am I correct that Collection/Doc/Collection/Doc chains incur no reads?

reads := 0
bucketDocRef := s.fsClient.Collection("accounts").Doc(accountID).Collection("widgets").Doc(widgetID)
// no cost so far?

此外,调用 .Collections(ctx)的费用是多少?...从 iter.GetAll()返回的每个collectionRef读取1吗?

Also, what is the cost for a call to .Collections(ctx) ... is it 1 read for each collectionRef returned from iter.GetAll()?

iter := docRef.Collections(ctx)
colRefs, _ := iter.GetAll()
reads += len(colRefs)

此外,如果对 iter.GetAll()的调用导致错误,将花费多少钱?

Also, what is the cost if the call to iter.GetAll() results in an error?

推荐答案

Collection Document 只是构建器函数.除了建立对集合和文档的引用之外,他们什么都不做.他们实际上并没有执行任何查询或读取任何数据,这意味着从Firestore计费的角度来看,它们实际上是免费的".

Collection and Document are just builder functions. They don't do anything other than build references to collections and documents. They are not actually performing any queries or reading any data, which means they are effectively "free" from the perspective of Firestore billing.

在您的示例中,在您致电 GetAll 之前,您无需支付任何费用,该费用每个返回的文档读取1次,再加上所需的出口.

In your example, you won't be billed anything until you call GetAll, which costs 1 read per document returned, plus whatever egress is required.

这篇关于Firestore docRef.Collections(ctx)的读/写成本是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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