Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

270
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda