Hi,
I have the following pipeline as in the example at: https://docs.mongodb.com/manual/reference/operator/aggregation/first/
db.sales.aggregate(
[
{ $sort: { item: 1, date: 1 } },
{
$group:
{
_id: "$item",
firstSalesDate: { $first: "$date" }
}
}
]
)
But now, I want to return for each “item” the whole document that associates with the group results
Thanks,
Itzhak