def recover_in_db(cls, recovery_id, email): """ Recovers the password in the database with a unique recovery ID :param recovery_id: ID to ensure a secure recuperation of the password :return: Boolean """ recovery_in_DB = cls( **Database.find_one(COLLECTION, {'_id': recovery_id})) if recovery_in_DB is None: return False else: Database.remove(COLLECTION, {'_id': recovery_id}) return True
def remove_from_mongo(self): Database.remove(COLLECTION, self.json())
def delete_from_mongo(self, collection: str): Database.remove(collection, {"_id": self._id})