Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

128
Views
Firestore not listing documents which doesn't have fields instead having sub collections

I am working on an attendance project. So, I have nested documents and collections. But problem is that:

Firestore not listing documents that don't have fields. Firebase db structure Pic it only listing documents that have fields.

I am doing this in JavaScript.

db.collection("Attendence").get().then((querySnapshot) => {
querySnapshot.forEach((doc) => {
    // doc.data() is never undefined for query doc snapshots
    console.log(doc.id, " => ", doc.data());
});

});


about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Firestore not listing documents that don't have fields.

That's the expected behavior. The documents that I see listed in italics ("CG1", "CSE A1", and "DG2") are not actually documents present in the collection.

The documents that are present in the "Attendence" collection and are writen in italics mean that there exist some subcollections with other documents added under those document IDs.

There is no query that can return those documents since they don't exist. So in other words, you have just reserved some IDs for some documents in that collection and then create a subcollection under it. These kinds of documents are visible in the Firebase Console because you might want to navigate into their subcollections.

One thing to remember, in Cloud Firestore documents and subcollections don't work like filesystem files and directories. If you create a subcollection under a document, it doesn't implicitly create any parent documents. Subcollections are not tied in any way to a parent document.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!