Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

162
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!