Aggregation and projection help

Hi Neeraj,

If you need the exact structure which you mentioned there are several ways to achieve this by using combinations of ($group and $unwind) or ($addFields and $mergeObjects). I am sharing a solution which uses $addFields and $mergeObjects - Mongo playground

Hope this solves your problem.

1 Like