-2

enter image description here

This is the line of code that attempts to get the documents in collection "notes". Currently for some reason in the DocumentSnapshot List only the manually added (directly in the Firebase site) documents appear, and the documents that are added through the app are ignored.

enter image description here

The underlined documents are the manually added ones, and they are the only ones to appear in the DocumentSnapshot List (for some reason).

enter image description here

!This is how I add a document to the "notes" collection. enter image description here This is the path.

Just to be clear the data is saved properly. The problem is that it is ignored when attempting to retrieve it.

As I said, I tried adding the data to the "notes" collection manually. When I did that, the said data did appear in the DocumentSnapshot List. But the data that I uploaded through the app (in the "saveNoteToFirebase" method) did not appear.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Itay
  • 1
  • 1
    Please read https://meta.stackoverflow.com/questions/326569/under-what-circumstances-may-i-add-urgent-or-other-similar-phrases-to-my-quest – Sören Jun 03 '23 at 11:50
  • 2
    [Please do not upload images of code/data/errors.](//meta.stackoverflow.com/q/285551) – Sören Jun 03 '23 at 11:50
  • 2
    Please edit your question and add the code as text and **not** as an image. Besides that, please edit your question and add your database structure as a screenshot. – Alex Mamo Jun 03 '23 at 13:44

1 Answers1

0

If you look carefully, the document IDs that don't show up in your code are shown in italic in the screenshot. That means that there actually is no document with that ID, and that the console only shows that ID because there are subcollections under it.

No snapshots for these IDs will show up in read operations. The only way to get these IDs, is to create the parent (even if you leave it empty) when you create the subcollection.

Also see:

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
  • 1
    You're welcome. Do pay attention to the comments that folks left, for future questions you post though - as they are all correct. Following the rules on Stack Overflow (or really any community forum) makes it much more likely that people will help you. --- Also see [What should I do when someone answers my question?](https://stackoverflow.com/help/someone-answers) – Frank van Puffelen Jun 03 '23 at 16:15