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

95
Vistas
Calling multiple documents from nested collection firebase

I have a nested collection in firebase that goes like this:

await fire.firestore()
    .collection("groupsCategory")
    .doc(groupID)
    .collection('events')
    .doc(eventID)
    .collection("memberPicks")
    .onSnapshot((querySnapshot) => {
        if(isMounted){
            console.log("print indi event heree  " + querySnapshot.data().eventID)
       
            setEventName(querySnapshot.data().eventName)
            // setIndividualEventDetails(querySnapshot.data())
        }

when we get to memberPicks collection it looks like this:

What I'm trying to do is basically add all of the contents of this collection to a list so that I can count how many times each name is called.

But I am failing to combine all of the documents in this collection with the code I have above and I am not sure where I am going wrong

about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Your querySnapshot is a QuerySnapshot object, which represents a list of documents. So it doesn't have any data() property itself, but instead exposes a list of documents in its docs property.

To show the event ID for each of the documents in your query snapshot, you could do:

.onSnapshot((querySnapshot) => {
    if(isMounted){
        querySnapshot.docs.forEach((doc) => {
            console.log(doc.data().eventID)
   
            setEventName(doc.data().eventName)
        });
    }
about 4 years ago · Santiago Trujillo 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