I want to, in the same transaction, conditionally update items in the array, and conditionally add values from the array and set “someTotal” to the value.
I can do both of these things independently, the former via a regular update document, and the latter via an aggregation. Can’t seem to figure out how to do the former in an aggregation update and I don’t think I can do the latter in a regular update doc as I don’t think I have access to the documents values in the update doc.
It would help if you provide a real source document, a real update with its real result.
Right now you have 2 objects with someAmount all being 10 and someTotal also being 10. We really don’t know how someAmount should be reflected in someTotal.