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

164
Visualizações
Getting data from firebase cloud firestore

I have created a collection with

db.collection("userCal/"+currentUserUID+"/activities").add({event}) and now im trying to query all of this data from firebase but i dont think im doing it correctly.

it looks like this in firebase

enter image description here

and inside activities it looks like this:

enter image description here

I have this right not but its failing.

let doc = await fire
  .firestore()
  .collection('userCal')
  .doc(currentUserUID)
  .collection("activities")
  .get()

let dataObj = doc.data();
console.log(dataObj);
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

When you use get() on a CollectionReference to fetch multiple documents from that collection, it returns a QuerySnapshot unlike using get() on a DocumentReference that just returns a DocumentSnapshot of a single document. So you'll have to run a loop on all documents present in the response as shown below:

const qSnap = await fire
  .firestore()
  .collection('userCal')
  .doc(currentUserUID)
  .collection("activities")
  .get()

const data = qSnap.docs.map(d => ({ id: d.id, ...d.data() }))
console.log(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