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

325
Visualizações
Firebase set(),push(),child() features

I am writing comments to movies. But with this code i just can add one comment. When i add second comment, the first comment changes with the second one. But i want to add more comments for my movie. How can i achieve that? (show variable is my movie's id. My movie's id is one.) The code is:

 btnComment.addEventListener('click',(e)=>{
                var movieComment = document.getElementById('textComment').value;
                set(child(firebaseRef, 'Movies/'+ show + '/Comments/'), {
                movieComment: movieComment
                });
      });

My Firebase that i stored some movies enter image description here

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

If you want to keep a list of nodes in Firebase, consider using the push() method. To add a comment to the list with that:

push(child(firebaseRef, 'Movies/'+ show + '/Comments'), movieComment})

So we call push instead of set here, which generates a new child node with a unique ID under Comments.

Also see the Firebase documentation on adding a child node to a list and this classic blog post: Best Practices: Arrays in Firebase.

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