Kumaran Systems interview question

Query on mongodb with groupby match and sum