I am pretty sure the error message is different when you try
Because $objectToArray is not used at all. The error must be different. Please share as we might have a better idea of what is happening. In my case it worked with an error.
In the future, please avoid adding three little dots to your documents to show that you have more fields because we cannot cut-n-paste directly your documents.
It’s not quite clear from your original post, but are you looking for a generic solution to update all at once or specific query you can apply to a document?
Which obviously needs you to pass in the ID so that the array can be named.
I was trying to find a generic solution where it would take a field value as the input to a field name, but could not work out a way of doing that…maybe someone else can.