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

125
Views
Reading firebase child and grandchild snapshots-Web

trying to read in the following branch

 "finance": {
    "lvAN928K9qXJ5RGiRBUrb6seByM2": {
      "-N6XXgy0COp30w52pxzZ": {
        "link": "https://firebasestorage.googleapis.com/v0/b/myhouse-4ba96.appspot.com"
      },
      "-N6XXh2rkW0jT7MNpO2-": {
        "link": "https://firebasestorage.googleapis.com/v0/b/myhouse-4ba96.appspot.com"
      },
      "email": "app@email.com",
      "houseContractor": "General construction ",
      "houseCost": "2400000",
      "income": "1200000",
      "institution": "Commercial Banks",
      "nic": "123456789",
      "permit": "Yes"

I need to access from email to permit as well as the 2 link under the 2 keys. My code reads the data but the output is incorrect. All data goes in a table row.

Code i tried

try
{
    const dbref = ref(db);
    get(child(dbref,"finance")).then((snapshot)=>
    {
    var client=[];
    snapshot.forEach(childSnapshot =>{
        childSnapshot.forEach((grandchildSnapshot) =>{  
            if(grandchildSnapshot.hasChild("link"))
            {
                let item2=childSnapshot.val();
                let item=grandchildSnapshot.child("link").val()
                client.push(item);
                client.push(item2)
            }
            
        });
        
    });
    AddAllItemsToTable(client);


function AddAllItemsToTable(quotation) {
    tbody.innerHTML = "";
    quotation.forEach(element => {
        addItem(element.nic,element.email,element.permit, element.institution, element.income, element.houseContractor, element.houseCost,element.link,element.link);
    });

The output is produces

website

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!