0
 const docRef = firestore.collection("SequenceId").doc(doc.id);

 docRef.update({

                sequencenumber: {
                    [x]: false 
                  }

             })

Currently my database is My current database

After the above code is executed my database enter image description here

But i want only the value of 2: to be updated to false, while maintaining 3: and 4: . Here 3: and 4: gets deleted.

Paul Baiju
  • 419
  • 7
  • 20

1 Answers1

1

Firestore doesn't currently offer the ability to update a single item in an indexed array. Your alternative is to read the entire array from the document, modify it in memory, then write the entire array back to the document.

The only array update operations available are adding a new array ("arrayUnion") and removing an item from an array ("arrayRemove"). You can read the documentation for those operations.

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441