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

183
Views
How to access subcollection in firestore after .where

I have a collection and an array of names and the collection can be queried directly by id

I want to access a unique subcollection depending on a name and I want to return the sub collection after

Query is structured as such

firestore
.collection
.where("name", '==', inputName)
.collection('subCollection')
.get()

This does not seem to work, is there an alternative way

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

0

Firestore queries can only inspect data in the documents that they return. There is no way to return documents from the subcollection, and filter on a field from the parent documents.

The common solution is to add the name to each document in the subcollections too (say as a field called parentName), and then perform a collection group query across all collections named subCollection:

firestore
.collectionGroup('subCollection')
.where("parentName", '==', inputName)
.get()
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!