如何在使用.where in flutter后获得子集合

问题描述 投票:0回答:1

我想知道在使用.where之后是否有办法获得子集合

这是我的数据库格式

  • 用户< - 集合
  • Bob123
  • 帖子< - 子集合
  • POST1

Firestore.instance.collection("Users")
.where("followers", arrayContains: id)  //id is the users id 
//He i want to get the collection of posts that the particular user has posted
android firebase flutter google-cloud-firestore
1个回答
1
投票

子集合在单个文档下,而查询标识一组文档。如果您知道查询仅标识一个文档,则Firestore客户端不知道,即使它已经知道,它也不知道该文档的完整路径。

首先需要执行查询,然后获取单个文档,然后您可以获取每个文档的子集合。

© www.soinside.com 2019 - 2024. All rights reserved.