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

269
Views
Firebase Firestore: use .where() with a subcollection

I want to do something like this:

firestore().collection('users').collection("account").where('email', '==', "example@gmail.com").get();

I want to get user's data among users who has a specific email. But the problem here is that the email is in a subCollection.
How to do it?

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

0

That's the problem, in the current SDKs, you can't do this. you have to specify a full path, i.e :

collection1->doc->collection2.where(..etc

Would advise to move this key \email to the doc in the first collection if it's that important. Otherwise, you have to run multiple chained queries. Or fetch all the docs in collection#1, then for each doc, run your where query on every one of those docs and look into their subcollections, but it'll cost you lots of reads. Consider restructuring your data.

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!