I'm trying to implement firestore into my flutter app. My documents on firestore have an array field which has objects. These objects have an array too. It looks like this:
Topics[
{
"id": "1234"
"questions": [] <-- This field I want to update
}
]
I know that I can update fields with the updateData() function of myDocument.reference. There I can update my value inside an array like this:
mydocument.reference.updateData({
"topics.id": 1
})
This works fine for easy structures but what I need is to get a specific index of the topics array where I get the object an its questions array which I want to update. Something like this:
document.reference.updateData({
"topics[$index].questions": FieldValue.arrayUnion([q])
});