Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

237
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda