'This method makes use of the aggregation framework to
produce top values for a given field.
If `distinct` is True (default), the top values are computed
by distinct events. If it is False, they are computed based on
the "count" field.'

def topvalues(self, field, distinct=True, **kargs):

    if (not distinct):
        kargs['countfield'] = 'count'
    pipeline = self._topvalues(field, **kargs)
    return self.set_limits(self.db[self.colname_passive].aggregate(pipeline, cursor={}))
