Reputation: 1468
How do you, or is it even possible to, stream only one field in a firestore document. I would like to stream the data for only one key value which is a List? For example:
DocumentSnapshot {
'firstname':'Joe',
'lastname':'Smith',
'friendsList': [[email protected], [email protected], [email protected]]
}
Can I stream only the 'friendsList' field or do I have to pull the whole DocumentSnapshot ?
Upvotes: 1
Views: 831
Reputation: 317798
You can think of a document is an atomic unit. If it's read by the user account, then entire document will always be transferred and cached as a unit. There are no partial document reads.
In the interest of speeding up requests, you might choose to split the contents of a single document into multiple documents among multiple collections, so that only the minimal amount of information is fetched for different use cases that require different fields. Splitting up a document like this is also good for protecting different fields with different security rules.
Upvotes: 5