I have a collection by name "trips" in Firestore. The data format is something like this
I'm trying to access documents of that Collection by using below code.
First way
try {
Firestore.instance
.collection("trips")
.where("createdByName", isEqualTo: "Suresh")
.snapshots
.listen((data) => print('Firestore response1: ${data.documents}'));
} catch (e){
print('Caught Firestore exception1');
print(e);
}
Second way
try {
Firestore.instance.collection("trips").where("createdByName", isEqualTo: "Suresh").getDocuments().then((data) {
print('Firestore response2: , ${data.documents}');
});
} catch (e){
print('Caught Firestore exception2');
print(e);
}
But, none of the above two ways is working. Don't know what I'm doing wrong.
One thing I've noticed whenever I'm removing the where("createdByName", isEqualTo: "Suresh") part from the query it's working fine. But, the moment I include that part query is returning an empty result.

createdByName