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

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

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