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

95
Views
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 answers
Answer question

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 Report
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!