If you know how to write it in SQL, the same principle applies to MongoDB. This is a very common grouped aggregation query. The answers are below, but I still hope you can try to search for the answers online and exercise your ability to solve problems independently.
If you know how to write it in SQL, the same principle applies to MongoDB. This is a very common grouped aggregation query. The answers are below, but I still hope you can try to search for the answers online and exercise your ability to solve problems independently.
The answer can be easily obtained using aggregation’s $max operator.