Having spent more time in MongoDB aggregations than I'd like to lately, I really wish they'd support this. So much more sensible than the madness they've got going on.
(Disclaimer: I'm a PRQL contributor.)
They are painful to write compared to SQL queries.
Although the commercial version of MongoDB has support for SQL, it's not available for general MongoDB users.
Those do look awful and more what I remember from the brief period when I used MongoDB in around 2013 or so.
I take it GP comment was just trolling then?
There are examples on Mongo's page, eg https://www.mongodb.com/docs/manual/core/aggregation-pipelin...
eg:
db.orders.aggregate( [
// Stage 1: Filter pizza order documents by pizza size
{
$match: { size: "medium" }
},
// Stage 2: Group remaining documents by pizza name and calculate total quantity
{
$group: { _id: "$name", totalQuantity: { $sum: "$quantity" } }
}
] )