def save_user(self, user: User): try: if (len(list(self.collection_users.find({"username": user.username})))==0): self.collection_users.insert_one(user.jsonify()) return True return False except: return False
def modify_user(self, username: str, password: str, user: User): modify = self.collection_users.update_one( { "username": username, "password": password }, {"$set": user.jsonify()}) if modify: return True return False