Reputation: 590
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..
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.
Upvotes: 1
Views: 857
Reputation: 317362
You can use FieldValue.arrayUnion() to add a new element to an array field of a document.
Upvotes: 2