def remove_duplicates_process(): dump_date = get_dump_date(MONGO, ARCHIVES_BASE_FOLDER) if is_dump_date_valid(dump_date): mongodb = MongoDB() mongodb.connect() mongodb.remove_duplicates() mongodb.disconnect()
def remove_documents_with_null_values_process(): dump_date = get_dump_date(MONGO, ARCHIVES_BASE_FOLDER) if is_dump_date_valid(dump_date): mongodb = MongoDB() mongodb.connect() mongodb.remove_documents_with_null_values() mongodb.disconnect()
def drop_database_process(): dump_date = get_dump_date(MONGO, ARCHIVES_BASE_FOLDER) if is_dump_date_valid(dump_date): mongodb = MongoDB() mongodb.connect() mongodb.drop_database() mongodb.disconnect()
def mongodb(self) -> MongoDB: if not self.has_mongodb(): raise NoConnectionError('No MongoDB configuration') mongodb = MongoDB(self._mongodb_configuration) mongodb.connect() self._instances.append(mongodb) return mongodb