Currently there are no plans to support js inside of the aggregation
framework. If you really need that, you will have to use map/reduce.
You can use $minute / $hour, etc inside of a group to group by time. Doing
the 5 and 15minute bucketing will be tricky, but should be possible using
feel free to create a jira ticket to make time bucketing easier.
Also, you will need to do each bucket size as a separate aggregation as
each $group is currently limited to a single key. I am considering lifting
that restriction for 2.2, but not sure yet.