The <expression> can be any valid expression that resolves to an array of two-element arrays or array of documents that contains “k” and “v” fields.
I am sure you are clear with above provided instruction in $arrayToObject.
For your case you can use $map to reconstruct array to array of two-element arrays where the first element is the field name, and the second element is the field value and than convert to object,
Thanks so much for your help Vishal! I would add that I didn’t suspect that ‘k’ and ‘v’ were like… fixed constants that one needs to use. My impression when reading the documentation was that any format of [ { “key1”:“value1”}, {“key2”:“value2”}… ] would work.