0

I’m having problems finding the the right approach to adding new data to a Firebase document (using JavaScript)

My document structure is as follows..

Firebase document structure

I want to be able to add a new child (as in kids) and a new class (as in school classes) objects to the children and classes arrays. I tried update, but that just overwrote existing data.

Doug Stevenson
  • 268,359
  • 30
  • 341
  • 380
JakeKempo
  • 552
  • 1
  • 5
  • 13

1 Answers1

1

You can use FieldValue.arrayUnion() to add a new element to an array field of a document.

Doug Stevenson
  • 268,359
  • 30
  • 341
  • 380