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

281
Views
I'm trying to read a field of all Documents at the same time but I'm only getting the field of first document

I'm trying to get the field items(array) of all my documents Orders, but I can only get one of my documents field at a time. I want it to show the whole Order detail as well.

Output i get Firestore database

Here is the code I have:

function receiptData() {

    document.getElementById("pro").innerHTML = "";
    firebase
        .firestore()
        .collection("orders")
        .get()
        .then((querySnapshot) => {

            querySnapshot.forEach((doc) => {

                console.log(doc.id, " => ", doc.data());

                var data = doc.id;

                for (let i = 0; i < doc.id.length; i++) {


                    let row = `<tr>
                            <td><a>${(doc.data().items[i]["productname"])}</a></td>
                            <td><a>${(doc.data().items[i]["cart_quantity"])}</a></td>
                            <td class="text-danger"> <a>${doc.data().total_amount}</a> <i class="mdi mdi-arrow-down"></i>
                            </td>
                            <td>
                                <label class="badge badge-danger"><a></a></label>
                            </td>
                            </tr>`;

                    document.getElementById("pro").innerHTML += row;
            }

        });
    });
}
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!