【发布时间】:2019-08-23 06:26:34
【问题描述】:
我正在使用 Flutter 和 Firebase Cloud Firestore。请问,如何按字段查询 CollectionReference?喜欢:
* database
** collection
*** document
**** field (string) to query
【问题讨论】:
标签: firebase dart flutter google-cloud-firestore
我正在使用 Flutter 和 Firebase Cloud Firestore。请问,如何按字段查询 CollectionReference?喜欢:
* database
** collection
*** document
**** field (string) to query
【问题讨论】:
标签: firebase dart flutter google-cloud-firestore
您必须使用where 方法查询您的收藏。然后,您将获得所有符合条件的文档。
firestore.collection('myCollection').where('yourField', isEqualTo: 'any');
【讨论】:
string started。
我正在使用它,它可以工作
CollectionReference getRecord() {
try {
CollectionReference collectionReference = Firestore.instance.collection("collection-one").document("document one").collection("collection-two").where('field name', isEqualTo: 'string value');
return collectionReference;
} catch (e) {
print('throw:' + e);
return null;
}
}
【讨论】: