'Perform a aggregate function based in your queryset params
:param pipeline: list of aggregation commands,            see: http://docs.mongodb.org/manual/core/aggregation-pipeline/
.. versionadded:: 0.9'

def aggregate(self, *pipeline, **kwargs):

    initial_pipeline = []
    if self._query:
        initial_pipeline.append({'$match': self._query})
    if self._ordering:
        initial_pipeline.append({'$sort': dict(self._ordering)})
    if (self._limit is not None):
        initial_pipeline.append({'$limit': self._limit})
    if (self._skip is not None):
        initial_pipeline.append({'$skip': self._skip})
    pipeline = (initial_pipeline + list(pipeline))
    return self._collection.aggregate(pipeline, cursor={}, **kwargs)
