From 81a5ca476f2e9b4920bf5b3a85f502110ebab7e7 Mon Sep 17 00:00:00 2001
From: Quentin Duchemin <quentinduchemin@tuta.io>
Date: Sun, 20 Oct 2019 18:15:47 +0200
Subject: [PATCH] Update Mongo backup command to be compatible with 4.x

Update to Buster is really annoying with Mongo rly, should work with that trick
---
 db-backup/mongo-run.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/db-backup/mongo-run.sh b/db-backup/mongo-run.sh
index b8a162c2..570193cc 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
 
-- 
GitLab