Reputation: 905
The firestore can't get data with specific fields (ref).
I am using firestore in the flutter. It will not safety when I fetch all fields of a collection in the client app. The user can read some fields that the user shouldn't read.
Why firebase doesn't generate this function?
What I should do?
How do most people solve this problem?
Should I generate a sub-collection with only one document that is secret fields?
Should I generate a new collection containing the document id field that is the document id of a secret document that contains secret fields?
Or anything else, I am new to NoSQL and Firebase. Please, suggest me. Thank you.
Upvotes: 0
Views: 91
Reputation: 599571
The two most common options are indeed to:
In both cases you can then secure access to the documents with security rules.
Upvotes: 2