def get_stat_of_author(self, author):
    cur = self.db['reports'].aggregate([{'$match': {'author': author}}, {'$group': {'_id': None, 'avg_total_words': {'$avg': '$words.total_words'}, 'avg_unique_words': {'$avg': '$words.total_unique_words'}, 'avg_persent_unique_words': {'$avg': '$words.persent_unique_words'}, 'unique_words': {'$addToSet': '$words.unique_words'}, 'avg_total_raw_symbols': {'$avg': '$symbols.total_raw_symbols'}, 'avg_total_clean_symbols': {'$avg': '$symbols.total_clean_symbols'}, 'total_reports_loaded': {'$sum': 1}}}, {'$addFields': {'unique_words': {'$reduce': {'input': '$unique_words', 'initialValue': [], 'in': {'$setUnion': ['$$value', '$$this']}}}}}, {'$addFields': {'total_unique_words': {'$size': '$unique_words'}}}])
    return cur.next()
def get_stat_of_author(self, author):
    cur = self.db['reports'].aggregate([{'$match': {'author': author}}, {'$group': {'_id': None, 'avg_total_words': {'$avg': '$words.total_words'}, 'avg_unique_words': {'$avg': '$words.total_unique_words'}, 'avg_persent_unique_words': {'$avg': '$words.persent_unique_words'}, 'unique_words': {'$addToSet': '$words.unique_words'}, 'avg_total_raw_symbols': {'$avg': '$symbols.total_raw_symbols'}, 'avg_total_clean_symbols': {'$avg': '$symbols.total_clean_symbols'}, 'total_reports_loaded': {'$sum': 1}}}, {'$addFields': {'unique_words': {'$reduce': {'input': '$unique_words', 'initialValue': [], 'in': {'$setUnion': ['$$value', '$$this']}}}}}, {'$addFields': {'total_unique_words': {'$size': '$unique_words'}}}])
    return cur.next()