def get_by_id(cls, _id): data = Database.find_one("users", {"_id": _id}) if data is not None: return cls(**data)
def from_mongo(cls, id): postdata = Database.find_one(collection='posts', query={'_id': id}) return cls(**postdata)
def get_by_email(cls, email): data = Database.find_one("users", {"email": email}) if data is not None: return cls(**data)
def get_from_mongo(cls, id): blog_data = Database.find_one(collection='blogs', query={'_id':id}) return cls(**blog_data)