Nirvana Dogra
Nirvana Dogra

Reputation: 59

Firestore is not retrieving the complete data values

Image 1 shows the hierarchy of my DB.

I am trying to retrieve the names of the courses [Android, Branding .... ]. The data in italics(Branding, others) gets added by the backend - post commands, and the other data is added typing. While retrieving only the non - italics data gets retrieved as seen in screenshot 2. I can not figure out why this might be happening. Screenshot 2 also shows the query I am using to the same. Please help !!

Thank you. Firebase Screenshot

enter image description here

Upvotes: 0

Views: 418

Answers (1)

Muthu Thavamani
Muthu Thavamani

Reputation: 1405

While retrieving only the non - italics data gets retrieved as seen in the screenshot 2

Document IDs shown in italics - means there is not actually a document in its place; however, there are subcollections with documents organized underneath them. Firestore query returns only non-empty documents.

You have two options to go with,

  • If you are sure about your document IDs, you could directly access the collection
firestore.collection('users/groups/groupID/courses/others/courses').get()
  • Using collectionGroup queries; but it seems you have many collections with same ID courses, so it might retreive all and might not be suitable for you! I recommend you to read firabase doc for it's limitations
firestore.collectionGroup('courses').get()

Upvotes: 2

Related Questions