MongoDB Aggregate how to sum values in object array
I'm trying to add up two amounts within an object inside an Aggregate pipeline. Here's my sandbox: https://mongoplayground.net/p/LIvksL-UGur Document: [ { "result": { "invoices": [ { "product": "baseball", "amount": 4, "tax": 1 }, { "product": "basketball", "amount": 10, "tax": 2…