diff --git a/db-backup/mongo-run.sh b/db-backup/mongo-run.sh index b8a162c2bf80d5fb50dadf2515e533a5d0546c05..570193cc404352bc34d6be2eab9f90fd6f9d88fb 100755 --- a/db-backup/mongo-run.sh +++ b/db-backup/mongo-run.sh @@ -1,5 +1,6 @@ #!/usr/bin/env bash # Antoine Barbare 18/02/18 <antoine@barbare.me> +# Quentin Duchemin 20/10/19 add --forceTableScan to prevent error on newest Mongo versions BACKUP_FOLDER=${BACKUP_FOLDER:-"/backup/"} @@ -8,10 +9,10 @@ BACKUP_FOLDER=${BACKUP_FOLDER:-"/backup/"} [ -z "${MONGO_DB}" ] && { echo "=> MONGO_DB cannot be empty" && exit 1; } if [[ -z "${MONGO_USER}" && -z "${MONGO_PASS}" ]]; then - BACKUP_CMD="mongodump -d ${MONGO_DB} -h ${MONGO_HOST}:${MONGO_PORT} -o $BACKUP_FOLDER"'${BACKUP_NAME}' + BACKUP_CMD="mongodump --forceTableScan -d ${MONGO_DB} -h ${MONGO_HOST}:${MONGO_PORT} -o $BACKUP_FOLDER"'${BACKUP_NAME}' RESTORE_CMD="mongorestore -d ${MONGO_DB} -h ${MONGO_HOST}:${MONGO_PORT} " else - BACKUP_CMD="mongodump -d ${MONGO_DB} -h ${MONGO_HOST}:${MONGO_PORT} -u ${MONGO_USER} -p ${MONGO_PASS} -o $BACKUP_FOLDER"'${BACKUP_NAME}' + BACKUP_CMD="mongodump --forceTableScan -d ${MONGO_DB} -h ${MONGO_HOST}:${MONGO_PORT} -u ${MONGO_USER} -p ${MONGO_PASS} -o $BACKUP_FOLDER"'${BACKUP_NAME}' RESTORE_CMD="mongorestore -d ${MONGO_DB} -h ${MONGO_HOST}:${MONGO_PORT} -u ${MONGO_USER} -p ${MONGO_PASS} " fi