MongoDB query get n records of each group (aggregation)
For example, you might want to get 5 members of each group in your application.
For example, you might want to get 5 members of each group in your application.
Consider our logs collection contains with each document has a set of logItems, each item store sold status and price: