Example #1
0
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()
Example #2
0
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()
Example #3
0
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()
Example #4
0
    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