The MongoDB Aggregation Pipeline by Example
The aggregation pipeline processes documents through a series of stages, each transforming the output of the previous one. It's MongoDB's answer to SQL's GROUP BY , joins and reporting queries. Revenue per day const revenue = await orders.aggregate([ { $match:...