0

Lets say I have an array field in a document:

entries: ["hello"]

I would like to append new elements to this array field i.e ["Yellow" ,"Blue"]

I did some research and most the techniques replace the entire record. How can I achieve this?

I'm using javascript.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
maxflow
  • 869
  • 4
  • 10
  • 16

1 Answers1

2

Check out this question: How to append something to an array? .

And looks like you are developing using firebase firestore, please take a look at their documentation here.

You'll have to retrieve the document you want to edit first, append the array, then update it.

regisin
  • 127
  • 1
  • 10