I have two sets of collections in firebase. One set that starts with a prefix 'user'
For example
... etc
and the other set that does not start with any particular prefix.something like
..etc
Is there a way that I can apply a set of security rules using wildcard or any other means for all the collections that starts with 'user_' and another set of rules for other set of collections
You can select specific collections that starts with user_
like this:
service cloud.firestore {
match /databases/{database}/documents {
match /{collection=user_**}/{doc} {
// Rules for collections that does start with user_
}
match /{collection=!(user_**)/{doc} {
// Rules for collections that doesn't start with user_
}
}
}
You can read more about control access to specific fields here. I hope it helps