In Firestore, how can I get the total number of documents and the id's of these in a collection?
For instance if I have
/Usuarios
/Cliente
/JORGE
/456789
/filtros
/status
/activo
/inactivo
My code:
FirebaseFirestore db = FirebaseFirestore.getInstance();
Task<QuerySnapshot> docRef = db.collection("Usuarios").document("Cliente").collection("JORGE").document("filtros").collection("status").get()
.addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
@Override
public void onComplete(@NonNull Task<QuerySnapshot> task) {
if (task.isSuccessful()) {
int contador = 0;
for (DocumentSnapshot document: task.getResult()) {
contador++;
}
int cantPS = contador;
}
I want to query how many people I have and get: 2 and the id's: activo, inactivo.