For example,
In the image below, I want to get the document ID that has 'banana' in its food field. How can I query all documents in 'store1', find the field that has 'banana', and then return that document ID that contains it?
CodePudding user response:
You can run a query and get the id in then
Firestore.instance
.collection('Store1')
.where("food", isEqualTo: "banana")
.getDocuments()
.then(
(QuerySnapshot snapshot) => {
snapshot.documents.forEach((item) {
print("documentID is : " item.reference.documentID);
}),
},
);