def create( cls, start_at=None, end_at=None, duration=None, delta=None, period=None, filter_by=None, group_by=None, sort_by=None, limit=None, collect=None, ): delta = None if duration is not None: date = start_at or end_at or now() delta = duration if start_at else -duration start_at, end_at = cls.__calculate_start_and_end(period, date, delta) return Query(start_at, end_at, delta, period, filter_by or [], group_by, sort_by, limit, collect or [])
def save(self, obj): obj['_updated_at'] = timeutils.now() self._mongo.save(obj)