Statement
Write revenueByCustomer(orders). Each order has customerId, total (cents) and status. Only paid orders count. Return [{ customerId, orders, revenue }] sorted by revenue descending (ties: customerId ascending). It's what you'd do in MongoDB with $match + $group + $sort: also write that aggregation pipeline in the comment at the end (it doesn't run, but the review takes it into account).