【问题标题】:How to get document snapshot where name in data map in collection in flutter [closed]如何在颤动中获取数据映射中名称的文档快照[关闭]
【发布时间】:2021-05-08 17:36:52
【问题描述】:
我正在尝试通过在数据中搜索配方名称和配方名称来获取文档快照:
Query query = FirebaseFirestore.instance
.collection("recipes")
.where("name", isEqualTo: "test");
QuerySnapshot querySnapshot = await query.get();
【问题讨论】:
标签:
firebase
flutter
dart
google-cloud-firestore
snapshot
【解决方案1】:
您的name 字段存储在对象data 中。所以查询应该在data.name
Query query = FirebaseFirestore.instance
.collection("recipes")
.where("data.name", isEqualTo: "test");
要了解嵌套对象和. 表示法,请参阅fields in nested objects 上的文档。