I have objects that pretty much look like this:
{
...
someArray: [
{
id: 1548,
amount: 153,
done: 0
}
]
...
}
As these objects can become quite large, I can't just use set
everytime I'm updating them, as sending 100kB everytime I need to update the document isn't an option.
In order to solve this, I decided to use update
with what's called the "dots notation", example usage being :
update({
'a.b.c': true
})
Source: Difference between set with {merge: true} and update
So I decided to give it a try and it worked like a charm for "normal" nested fields, but I can't find how I can do this for objects that are nested inside arrays.
What I tried was this:
update({
'a.someArray.0.done': 153
})
update({
'a.someArray[0].done': 153
})
But both of these just erased the object and replaced it by the patch, meaning that the dots notation wasn't recognized properly.
How can I solve this? Is there a solution for this kind of approach or should I just refactor it using a subcollection?