Reputation: 445
I have a collection called IDS in cloudfirestore, inside it, there is a document called IDs,inside this document I have fields starting with ID1 to reach almost ID14000,The user enters his id inside a textfield,I need to check if the id exists in the fields thanks.
Upvotes: 1
Views: 1596
Reputation: 3232
final CollectionReference dbIDS = Firestore.instance.collection('IDS');
QuerySnapshot _query = await dbIDS
.where('ID', isEqualTo: theUserInputID)
.getDocuments();
if (_query.documents.length > 0) {
// the ID exists
}
Upvotes: 2