Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

279
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda