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

226
Views
How do I handle unnamed nodes in my firebase realtime database using javascript?

Database { "chats": { "3q7QDEHAVpU3DhiNyAOKlZY7L0S25rAQ6mD63HRiygVytCutjMfyZr43": { "messages": { "-MhP9vpwRKLND9tIBBOT": { "message": "thanks", "senderId": "5rAQ6mD63HRiygVytCutjMfyZr43", "timeStamp": 1629305419888 }, "-MhSZ8z1kObr2W0UOdZK": { "message": "hello", "senderId": "3q7QDEHAVpU3DhiNyAOKlZY7L0S2", "timeStamp": 1629362363332 }, } }, "3q7QDEHAVpU3DhiNyAOKlZY7L0S2Ud9F8Ke4bZTMu9vMf5GF98jnwng2": {}, "5rAQ6mD63HRiygVytCutjMfyZr433q7QDEHAVpU3DhiNyAOKlZY7L0S2": {}, } }

I want to retrieve data from the real time database but due to unnamed nodes I am not able to capture the data. Please help me? When I run the function I getting null in console.log:

Path is correct but snapshot shown null in console: snapshot: null

function selectAllData6() {
    var Id1 = this.id;
    var Path1 =               firebase.database().ref("chats/{senderId}/messages/{receiverId}/message");
    Path1.on('value', function(snapshot) {
    var message = snapshot.val();
    console.log("message: " + message);
    console.log("Path1: " + Path1);
    console.log("snapshot: " + snapshot.val());
    });
}
selectAllData6();

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!