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