In exploring ways to do real-time analytics with MongoDB, there seems to be a fairly standard way to do sums, but nothing in terms of more complex aggregation. Some things that
Could you do some atomic or optimized/real-time operation that grouped the birthdays into something like this?
It looks like you've added two fields age_rank
, average_age
. These are effectively calculated fields based on the data you already have. If I gave you the document with page views and user birthdays, it should be really trivial for the client code to find min/max, average, etc.
It seems to me that you're asking for MongoDB to perform the aggregation for you server-side. But you're adding the limitation that you don't want to use Map/Reduce?
If I'm understanding your question correctly, you're looking for something where you can say "add this item to an array and have all dependent items update themselves"? You don't want readers to perform any logic, you want everything to happen "magically" on the server side.
So there are three different ways to tackle this, but only one of them is currently available:
Unfortunately, your only option right now is #1. Fortunately, I know of several people that are using option #1 successfully.
There is work planned for the upcoming 1.9.x unstable release that may have aggregations.
See: https://jira.mongodb.org/browse/SERVER-447
Of course, it may get bumepd to a later release/