说我有这种结构
A (collection): { a (doc): { name:'Tim', B (collection):{ b (doc): { color:'blue' } } } }其中A和B是集合,而a和b是文档. 是否有一种方法可以通过一个查询获取根文档中包含的所有内容? 如果我这样查询
where A and B are collections while a and b are documents. Is there a way to get everything contained in a root document with one query? If I query like this
db.collection("A").doc("a").get()我刚得到name:'Tim'字段.我想要的是也获取所有B的文件. 我基本上希望我的查询返回
I just gets name:'Tim' field. What I want is to also get all B's documents. I basically wish my query returns
{ user:'Tim', B (collection):{ b (doc): { color:'blue' } } }是可能还是真的需要针对每个集合进行多个查询:/?
Is it possibly or do I really need to make multiple queries one for each collection :/ ?
说我有一个非常深的嵌套的表示用户个人资料的集合树,由于每次加载用户个人资料时,我都有一个读取请求的乘数,因此我的成本会像地狱般上升.1 x N其中N是我的树的深度:/.
Say I have a really deep nested tree of collections representing the user profile, my costs will raise like hell since each time I load a user profile I have a multiplier of read requests 1 x N where N is the depth of my tree :/.
推荐答案众所周知,默认情况下,Cloud Firestore中的查询是浅层的.虽然将来Google会考虑使用这种查询,但不支持这种查询.
As we know querying in Cloud Firestore is shallow by default. This type of query isn't supported, although it is something Google may consider in the future.