Pre-aggregation pipeline support

Hi, I recently started experimenting with Cubes, using the Mongo2 backend. I have a need to run a few pipeline stages ahead of the cubes-computed pipeline. This patch provides a way to inject pipeline stages. It also provides support for '$first' and '$last' aggregation operators.