Browse Source

Merge pull request #1875 from overleaf/sk-fix-multi-script

Fix the password-removal script, pass the `multi` flag to update

GitOrigin-RevId: 753f0911304cfe02e97e03e2e018a826c176e780
Simon Detheridge 7 years ago
parent
commit
7e1b4195c5
1 changed files with 11 additions and 6 deletions
  1. 11 6
      services/web/scripts/remove_password_fields_from_migrated_users.js

+ 11 - 6
services/web/scripts/remove_password_fields_from_migrated_users.js

@@ -18,13 +18,18 @@ function main(callback) {
     if (!commit) {
     if (!commit) {
       return callback()
       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()
-    })
+    )
   })
   })
 }
 }