1

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.

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.