How can I do this? I’ve looked at $mergeObjects and $addFields, but while either of those seem like they might work, I’m not exactly sure how to wrangle them into what I want.
I just realized my title doesn’t make sense. My bad. Seems I can’t edit. It should be: “How to merge the sum of different documents based on one field value?”
How to you get Composure:10 for _id:“6140d7ca11c1853b3d42c1e6” in
I can see that you have one pool:Composure,successes:9 and one pool:Composure,successes:1 and 9 + 1 = 10, but none of the _id or charid of Composure:9 matches the _id of the result.