Answer the question
In order to leave comments, you need to log in
Firestore: the total number of documents in the selection and getting them in chunks?
How to get the total number of documents in a selection from Google Firestore and how to get these documents in chunks (for example, from 1 to 20, from 21 to 40, etc.)? Thank you.
Answer the question
In order to leave comments, you need to log in
To get the number of documents using whereEqualTo , you need to do this:
FirebaseFirestore.getInstance().collection( "name_collection" )
.whereEqualTo("field", "value" )
.addSnapshotListener(
new EventListener<QuerySnapshot>()
{
@Override
public void onEvent( @Nullable QuerySnapshot value, @Nullable FirebaseFirestoreException e )
{
// Обработка ошибок
if ( e != null )
{
return;
}
Log.e( "MESSAGE", "Количество документов " + value.size() );
// Ниже действия над документами
...
}
}
);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question