【发布时间】:2020-12-08 15:30:33
【问题描述】:
我有这个 Firestore 数据架构:
rootCol/{rootDoc}/subCol1/{doc1Type}
rootCol/{rootDoc}/subCol2/{doc2Type}
我想获取subCol1 中的所有文档,其中rootDoc 包含具有特定字段的doc2Type。
我知道我可以使用简单的.where 调用来获取所有doc2Type where exampleField == ‘exampleString’,然后获取查找SubCol1 的路径。
但问题是subCol2 可以包含许多doc2Type 和exampleField。这意味着我的查询将返回许多 doc2Type,然后导致我对 subCol1/{doc1Type} 的查询被多次调用。
如何从exampleField == ‘exampleString’ 的每个subCol2 子集合中仅获取1 个文档?
【问题讨论】:
标签: node.js firebase google-cloud-firestore nosql firebase-admin