Reputation: 139
I'm facing the issue with gathering data to the list _alldata as my implementing rule .where(uid, isEqualTo: "ownerid") is not working. I want to get only data which has ownerid inside and would be equal to current user.
Thank you in advance!
getItemStreamSnapshots() async {
final User user = FirebaseAuth.instance.currentUser;
final uid = user.uid;
final data = await FirebaseFirestore.instance
.collection('Books')
.where(uid, isEqualTo: "ownerid")
.get();
setState(() {
allResults = data.docs;
});
return "complete";
}
Upvotes: 0
Views: 402
Reputation: 976
You are supposed to put
.where("ownerId", isEqualTo: uid)
Right now you are querying for data where the property named (Whatever is in UID) is equal to "ownerId"
.
Upvotes: 1