I want to list all the documents ID's from a collection. I have found some code that allowed this but it worked only for the documents that contains data but not for that ones that contains other collections (and documents and data). I used this code:
coordenadasCloud.collection("UbicacionTP").get().
addOnCompleteListener(object: OnCompleteListener<QuerySnapshot> {
override fun onComplete(p0: Task<QuerySnapshot>) {
if(p0.isSuccessful){
val list: MutableList<String> = ArrayList()
for (document in p0.result) {
list.add(document.id)
}
Log.d("huella", list.toString())
} else {
Log.d("huella", "Error en obtener documentos", p0.exception)
}
}
})
In my firestore database I have 3 documents inside "UbicacionTP". Two of them have just hashmap data and the other("permisos") has subcollections with more documents inside, this document id ("permisos") are not listed in the result on Logcat. Please help me with this issue, maybe I'm missing some code for that documents containing subcollections. Thanks
Principal collection with documents whose IDs I want to retrieve
Subcollections of the only one document that is not shown in the list of documents ID