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

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

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 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