Preface: this question is already asked here but user gave up and gave solution to first answer. This question also differs in that I have two similar collection structures,
A simple fix
A document needs to have at least one field for it to exist. If a document only contains sub-collections, then it is said to be a virtual/non-existent document and for this reason it is not possible for it to appear in queries or data snapshots.
consider adding a field like this
// initialize firestoreDatabase
val firestoreDatabase : FirebaseFirestore? by lazy { FirebaseFirestore.getInstance() }
// set at least one field
firestoreDatabase.collection("territories").
document("6").
set(hashMapOf(
"key" to "value"))
do a similar thing to any other document in your database.