Let's say I have a userSnapshot
which I have got using get
operation:
DocumentSnapshot userSnapshot=task.getResult().getData();
I know that I'm able to get a field
from a documentSnapshot
like this (for example):
String userName = userSnapshot.getString("name");
It just helps me with getting the values of the fields
, but what if I want to get a collection
under this userSnapshot
? For example, its friends_list
collection
which contains documents
of friends.
Is this possible?
Queries in Cloud Firestore are shallow. This means when you
get()
a document you do not download any of the data in subcollections.If you want to get the data in the subcollections, you need to make a second request: