def get_recovery(cls, _id=None): """ Fetches a list of the all the Recovery objects in the given collection :param _id: The specific ID of a particular collection :return: List of Recovery objects or one specific Recovery object """ if _id is None: return [ cls(**recovery) for recovery in Database.find(COLLECTION, {}) ] else: return [cls(Database.find_one(COLLECTION, {'_id': _id}))]
def from_blog(email): return [ stats for stats in Database.find(collection='baseball', query={'email': email}) ]
def find_by_author_id(cls, author_id): blog_data = Database.find(collection='blogs', query={'author_id': author_id}) return [blog for blog in blog_data]
def get_one(user_id, project_id): return [post for post in Database.find(collection='projects', query={'user_id':user_id, 'project_id':project_id})]
def from_user(user_id): data = [post for post in Database.find(collection='projects', query={'user_id':user_id})] return data
def from_blog(id): return [ post for post in Database.find(collection='posts', query={'blog_id': id}) ]