From 7e1b4195c5149df58cde39c2e8e48ff8b9184e4f Mon Sep 17 00:00:00 2001 From: Simon Detheridge Date: Mon, 17 Jun 2019 15:44:54 +0100 Subject: [PATCH] Merge pull request #1875 from overleaf/sk-fix-multi-script Fix the password-removal script, pass the `multi` flag to update GitOrigin-RevId: 753f0911304cfe02e97e03e2e018a826c176e780 --- ...emove_password_fields_from_migrated_users.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/services/web/scripts/remove_password_fields_from_migrated_users.js b/services/web/scripts/remove_password_fields_from_migrated_users.js index aa2c96caf9..1acbfc3f47 100644 --- a/services/web/scripts/remove_password_fields_from_migrated_users.js +++ b/services/web/scripts/remove_password_fields_from_migrated_users.js @@ -18,13 +18,18 @@ function main(callback) { if (!commit) { return callback() } - db.users.update(query, { $unset: { hashedPassword: 1 } }, (err, result) => { - if (err) { - return callback(err) + db.users.update( + query, + { $unset: { hashedPassword: 1 } }, + { multi: true }, + (err, result) => { + if (err) { + return callback(err) + } + console.log(`>> Updated users: ${JSON.stringify(result)}`) + return callback() } - console.log(`>> Updated users: ${JSON.stringify(result)}`) - return callback() - }) + ) }) }