【发布时间】:2021-11-25 01:53:56
【问题描述】:
我有一个collection 公司,每个公司都有一个集合employee。我想创建一个查询以根据其文档 ID 检索特定员工。你知道怎么做吗?
我在考虑使用 collectionGroup("employee"),但找不到访问文档 ID 的方法。
Stream<UserModel> streamFirestoreUser() {
return _db
.collectionGroup('employee')
.where("email", isEqualTo: emailController.text)
.limit(1)
.snapshots()
.map((event) => UserModel.fromJson(event.docs.first.data()));
}
【问题讨论】:
标签: flutter google-cloud-firestore flutter-web