From 25dc378c46f7b047f82d5848ae4d7b4d8ef39c5e Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Sun, 3 Apr 2022 00:01:12 +0300 Subject: [PATCH] Snap: Try to delete incomplete uploads when starting. Thanks to xet7 ! Related: #1298 --- snap-src/bin/mongodb-control | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/snap-src/bin/mongodb-control b/snap-src/bin/mongodb-control index da448e55f..31500ca02 100755 --- a/snap-src/bin/mongodb-control +++ b/snap-src/bin/mongodb-control @@ -75,6 +75,8 @@ if [ -z "$MONGO_URL" ]; then # Drop indexes on database upgrade, when starting MongoDB #mongo wekan --eval "db.getCollectionNames().forEach(function(col_name) { var coll = db.getCollection(col_name); coll.dropIndexes(); });" $BIND_OPTIONS mongo wekan --eval 'db.adminCommand({ setFeatureCompatibilityVersion: "4.4" });' $BIND_OPTIONS + # Delete incomplete uploads so that they would not prevent starting WeKan + mongo wekan --eval 'db.getCollection("cfs.attachments.filerecord").find( { "uploadedAt": { "$exists": true }, "copies.attachments" : null,"failures.copies.attachments.doneTrying" : {"$ne" : true}});' $BIND_OPTIONS else @@ -96,5 +98,7 @@ else # Drop indexes on database upgrade, when starting MongoDB #mongo wekan --eval "db.getCollectionNames().forEach(function(col_name) { var coll = db.getCollection(col_name); coll.dropIndexes(); });" $BIND_OPTIONS mongo wekan --eval 'db.adminCommand({ setFeatureCompatibilityVersion: "4.2" });' $BIND_OPTIONS + # Delete incomplete uploads so that they would not prevent starting WeKan + mongo wekan --eval 'db.getCollection("cfs.attachments.filerecord").find( { "uploadedAt": { "$exists": true }, "copies.attachments" : null,"failures.copies.attachments.doneTrying" : {"$ne" : true}});' $BIND_OPTIONS fi