0

When I add data to collection/document as "/first/second/third/..."

For Example, "/first/second/third/thirdONE" then "/first/second/third/thirdTWO" then "/first/second/third/thirdTHREE"

then I cannot get list of entries inside "/first/second/third/" But when I add entries from Firebase Console manually, It works! And, When I add an entry from the app it appears on firebase console as italic but when I do it manually it appears normal...!

val newEntry: String = "first/" +
                "second/" +
                "third/"
        firestoreDatabase
            .collection(newEntry)
            .get()
            .addOnSuccessListener { querySnapshot ->
                println("*** " + querySnapshot.size())
                for (document in querySnapshot) {
                    Log.d(
                        "*** Firestore",
                        document.id + " => " + " Data == " + document.data
                    )
                }
            }
            .addOnFailureListener { exception ->
                Log.w("***", "Error getting documents.", exception)
            }

[Solution] Add Some Data to the Field Section of Document.

Elias Fazel
  • 2,093
  • 16
  • 20
  • When a document ID is shown in the Firebase console in italics, it means that there is no document with that ID, but that there are subcollections under that ID. – Frank van Puffelen Feb 03 '19 at 01:49
  • I described the system behavior, and the likely explanation below. If that's not it, show the code of how you create the document in question. – Frank van Puffelen Feb 03 '19 at 01:51

1 Answers1

1

When a document ID is shown in the Firebase console in italics, it means that there is no document with that ID, but that there are subcollections under that ID. My guess is that you're creating a default document in the console (since the UI prompts you to do so), but don't create a document in code.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807