FireStore Rules - Firebase | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

FireStore Rules - Firebase

Does the following rules mean that every collection is readable and writable if user is authenticated EXCEPT of the "cities" collection (city field). cities/city is readable but not writable at all. is this description right? rules_version = '2'; service cloud.firestore { match /databases/{database}/documents { match /{document=**} { allow read, write: if request.auth != null; } match /cities/{city} { allow read: if request.auth != null; allow write: if false; } } }

6th Oct 2022, 3:02 PM
Yahel
Yahel - avatar
1 Answer
0
If you want users not to write to your database in the path /cities, remove the "if" and leave the "false" one, so no one will write to this database, they will only read whoever is authenticated, and I recommend reinforcing the rules because whoever is authenticated can write to the other's datas
8th Oct 2022, 6:19 PM
Félix Zamdamela
Félix  Zamdamela - avatar