예제 #1
0
 def get_by_id(cls, _id):
     data = Database.find_one("users", {"_id": _id})
     if data is not None:
         return cls(**data)
예제 #2
0
 def from_mongo(cls, id):
     postdata = Database.find_one(collection='posts', query={'_id': id})
     return cls(**postdata)
예제 #3
0
 def get_by_email(cls, email):
     data = Database.find_one("users", {"email": email})
     if data is not None:
         return cls(**data)
예제 #4
0
파일: blog.py 프로젝트: Shubhraaaj/Blogging
 def get_from_mongo(cls, id):
     blog_data = Database.find_one(collection='blogs',
                                   query={'_id':id})
     return cls(**blog_data)