So I thought I should share them with the world! I said: "World - wouldn't you like to know how to do all kinds of cool stuff with MongoDB aggregation framework?" and world said ... well, pretty much nothing, so I took that as a "yes".
I'm not going to explain what MongoDB is or what Aggregation Framework is (since you're here, maybe you already know, if not just go and read the linked pages) and instead I'll dive right into some examples.
Imagine you have a lot of records like these:
The basic aggregation query by type goes like this:
Next time we'll talk about the tricky things we need to do to aggregate by days of the week. It's actually quite simple to extract day of the week from an ISODate - what's not so simple is to turn it into something human readable - like "Wednesday" instead of 4! I'll show you how I do it.