'How do I check data exists at firestore

I'm working on a doctor appointment system, but when querying on firestore, "where" doesn't work at all. My code is ;

FirebaseFirestore.instance
  .collection('appointments')
  .doc()
  .collection('pending')
  .where("doctor", isEqualTo: _doctorController.text)
  .where("date", isEqualTo: Timestamp.fromDate(DateTime.parse(dateUTC + ' ' + date_Time)))
  .get().then((documentSnapshot){
    if(documentSnapshot.docs.isNotEmpty)
      {
      print("errror");
      }
    else{
      print(DateTime.parse(dateUTC + ' ' + date_Time));
      FirebaseFirestore.instance
          .collection('appointments')
          .doc(user.email)
          .collection('pending')
          .doc()
          .set({
        'name': _nameController.text,
        'phone': _phoneController.text,
        'description': _descriptionController.text,
        'doctor': _doctorController.text,
        'date': DateTime.parse(dateUTC + ' ' + date_Time),
      }, SetOptions(merge: true));

my firestore

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source