I'm new to firebase and I'm trying to use it in a small application. I'm used to work with relational db and it's weired for me the concept of document and collections of firebase because I didn't work with NoSql before.
I have a form which consists of firstName, lastName, age, gender and other attributes. I want to make a constraint that prohibit to enter two different users with the same firstName and lastName.
I choose the cloudfirestore for different reasons such as :
as mentioned in Choose a Database: Cloud Firestore or Realtime Database .
However in the cloudfirestore and under the tab Rules I have these lines:
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if true;
}
}
}
I need to add some validations or rules such as in the realtime database like Understand Firebase Realtime Database Rules.
Is there any sections that cover this part of validations rules in cloudfirestore that I missed? Any link or proposition will be welcome.
There are no separate validation rules in Cloud Firestore. Instead you'll write the validation logic as part of the write rules.
See the section on data validation in the Firebase documentation for more information, and some examples.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With