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

170
Views
Firestore query the documents in subcollections using their IDs

I have a structure of nested subcollections and documents. Each name of the documents in the experience subcollection represents userId of some user that has experience in that game.

DB structure

I have a converted that attaches this userId to the document:

experienceEntity.userId = snapshot.id;
experienceEntity.experience = snapshot.data().experience;

I want to query documents from all the experience subcollections of all the games that have a certain userId. E.g. I want to get all documents having 400riCGTB0YkxAF52maPUr5jKPN2 ID from the screenshot above. I was trying this:

const result = await firestore()
  .collectionGroup("experience")
  .withConverter(gameExperienceEntityConverter)
  .where("userId", "==", userId)
  .get();

return result.docs.map((snap) => snap.data());

... but it returns an empty array. If I remove the where clause - it returns all the documents from all experience subcollections without any filtering (there can potentially be millions of those at this point).

about 4 years ago · Santiago Gelvez
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!