Im using Cloud Firestore and im trying to create the security rules.
Now I ran into this Problem:
I have a function to get the user data (which is stored in "/user_data")
function getUserData() {
return get(/databases/$(database)/documents/user_data/$(request.auth.uid)).data;
}
And a dummy function to use this data
function doStuff() {
return getUserData() == null || getUserData() != null;
}
When I run it (with authenticated user - with user document) It just always returns false
Anyone can help?
user_data/$(request.auth.uid)
exists? Or that a specific field of this document has as specific value?data
returns a "map of the document data" and therefore I am not clear on what you want to check withgetUserData() == null
orgetUserData() != null
. – Renaud Tarnecdata.fieldName
, see firebase.google.com/docs/firestore/security/… – Renaud Tarnec