Beispiel #1
0
 def delete(self):
     Database.delete(collection="user", query={"_id": self._id})
Beispiel #2
0
 def find_one_class_username(cls, username):
     user_data = Database.find_one(collection="user", query={"username": username})
     return cls(**user_data)
Beispiel #3
0
 def update_one(self, data):
     Database.update_one(collection="user", query={"_id": self._id}, data={'$set': data})
Beispiel #4
0
 def find_one_class_id(cls,id):
     user_data = Database.find_one(collection="user", query={"_id": id})
     return cls(**user_data)
Beispiel #5
0
 def find_one_username(username):
     return Database.find_one(collection="user", query={"username": username})
Beispiel #6
0
 def find():
     return [user for user in Database.find(collection="user")]
Beispiel #7
0
 def find_one_id(id):
     return Database.find_one(collection="user", query={"_id": id})
Beispiel #8
0
 def delete(self):
     Database.delete(collection="document", query={"_id": self._id})
Beispiel #9
0
 def save_to_mongo(self):
     Database.insert(collection='user', data=self.get_json())
Beispiel #10
0
 def find_by_author(author_id):
     return [
         doc for doc in Database.find(collection="document",
                                      query={"author_id": author_id})
     ]
Beispiel #11
0
 def find_one_class_id(cls, id):
     doc_data = Database.find_one(collection="document", query={"_id": id})
     return cls(**doc_data)
Beispiel #12
0
 def find_one_id(id):
     return Database.find_one(collection="document", query={"_id": id})
Beispiel #13
0
 def find():
     return [doc for doc in Database.find(collection="document")]
Beispiel #14
0
 def save_to_mongo(self):
     Database.insert(collection='document', data=self.json_data())