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

97
Visualizações
Firestore update nested objects

I'm trying to add a message object in a nested map. As you can see in the screenshot below, I want to go in "us" then "0" then "messages" to add my object. enter image description here

I have used the following script :

firestore.collection("salon").document(idSalon).update( "us.0.messages",message );

When I use it, it just overwrites everything as you can see. enter image description here

Can someone help me, please?

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

0

As I see in your screenshot, the "us" field is of type array. To be able to update an array, you should use arrayUnion and not a simple field update. For that I recommend you check the official documentation regarding update elements in a Firestore array.

I have also written an article called:

  • How to update an array of objects in Firestore?

That I think it will help you understand this topic better.

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