I'm designing the structure for a Firestore project and I'm struggling to find the optimal solution to my problem.
Basically I have a organisations - collection and in each document I want some fields public and some private.
organisations (collection)
- autoID (document)
- public (object)
- private (object)
The corresponding security rules would look something like:
match /organisations/{id} {
match /private {
allow read, write: if false; // or if user is a member..
}
match /public {
allow read, write;
}
}
But as far as I know there is no way to query for specific objects in a document? Would restructuring the data to two root collections with different security rules be optimal? I bet the database would get very complex if I would like to setup several access levels (manager, admin, member etc)