1

I am wondering how I can update an item in a multidimensional array in Firebase.

It would go Collection -> Document -> Field -> Array -> Array -> Field

See my attached screen shot.

I need to update the accountBodyContent

enter image description here

Jason
  • 1,091
  • 4
  • 19
  • 40
  • Does this answer your question? [Firestore Update single item in an array field](https://stackoverflow.com/questions/52187985/firestore-update-single-item-in-an-array-field) – Deniss T. Feb 05 '21 at 15:24
  • You won't be able to *modify* an element within your nested array but you can try **arrayUnion** and **arrayRemove** methods that are mentioned in the thread that I linked, in order to *replace* it. – Deniss T. Feb 05 '21 at 15:27
  • 1
    Thank you, I figured out that I would have to rewrite the whole document which could be costly so I am restructuring my document. – Jason Feb 05 '21 at 15:28
  • @DenisT. make this an answer and I will accept it – Jason Feb 05 '21 at 15:29

1 Answers1

1

You won't be able to modify an element within your nested array but you can use arrayUnion and arrayRemove methods to replace it.

Firestore Documentation

Deniss T.
  • 2,526
  • 9
  • 21
  • Do you mind looking at another issue of mine https://stackoverflow.com/questions/66065378/download-json-file-from-firebase-storage – Jason Feb 05 '21 at 15:34