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

205
Views
Why does my documents reference gets saved instead of the actual data (Firebase)

My Code:

getDocs(collection(db, "courses")).then(async item=>{
    const courses = [];
    await item.forEach(async course => {
        let temp_courses = course.data();
        let topics = temp_courses.topics
        await topics.map(async (item,index) => {
            let temp_item = item;
            let exercises = item.exercises;
            const temp_exercises = []
            await Promise.all(exercises.map(async exercise=>{
                await getDoc(exercise).then(item=>{
                    temp_exercises.push(item.data())
                })                         
            }))
            temp_item.exercises = temp_exercises;
            temp_courses.topics[index] = temp_item;
        })
        courses.push(temp_courses)
    })
    console.log(courses)
    localStorage.setItem("courses", JSON.stringify(courses));
});

Problem: I am querying the course collection from my firebase, and inside the course documents, I am querying another document.

I tried to query the reference as seen and it works, but when I tried saving it into local storage the data is stored as a reference instead.

How can I store the actual data instead?

Image Attached:

Console: The exercise portion is shown

LocalStorage: The exercise portion is a reference to the document instead

about 4 years ago · Juan Pablo Isaza
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!