Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firestore returning no records yet, I see them in console

from my app and javascript console

firestore.collection('organizations/f1f4002a-1fb2-4805-baf1-a1a709f228e9/emailsSent').get().then(console.log)

returns QuerySnapshot with empty: true

yet there IS clearly one record. Every other query I write seems to work. ie assignmentLogs, emails, etc.

```

firebase console

I feel like I'm going crazy and it's probably something really stupid so I apologize in advance.

like image 205
Enric Ribas Avatar asked Jan 19 '26 04:01

Enric Ribas


1 Answers

Notice that the document name 455...2c2 is shown in italics in the console, which definitely not the normal case for documents displayed in the console. That italics actually means that the document was deleted, however, it probably contains other subcollections that were not deleted (try clicking into it).

Since Firestore queries are shallow, the get() you're trying to perform is not going to yield any documents, because there are not actually any documents in that collection.

Something in your system may have deleted that document and not deleted its subcollections, so it's probably worthwhile to figure out what's responsible for that delete, and modify it so that it deletes its subcollections as well (otherwise they will remain "orphaned" in your database like this indefinitely).

Meanwhere, there's nothing much you can do about your query as shown - it's returning the correct results.

like image 107
Doug Stevenson Avatar answered Jan 21 '26 16:01

Doug Stevenson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!