I am trying to get the data from a DocumentSnapshot from firebase.
Firestore.instance.collection('products').document("Lucius_Malfoys_Zauberstab").get().then((DocumentSnapshot ds) {
print(ds.exists);
});
This method works totally fine and returns true, but:
var keys = ["Lucius_Malfoys_Zauberstab"];
String id = keys[0];
print(id); ---> prints Lucius_Malfoys_Zauberstab
Firestore.instance.collection('products').document(id).get().then((DocumentSnapshot ds) {
print(ds.exists);
});
returns false...
Does anyone have an idea, why this is the case? It is just a small problem in my application, but I am curious why this happens. Just for understanding. Thank you!
EDIT:
Here is a screenshot of the cart collection:
Here is a screenshot of the products collection:
I can't reproduce the problem. The best I can do at this point is show you what I've done:
The first print of
false
is before I had the document. I then created the document, ran_test
again, and it printedtrue
.If I remove my permission on
/55652643/{document}
, theprint
statement isn't reached, and instead I get a stack trace that permission has been denied.