'use strict'; /* globals db */ const cursor = db.users.find({ }); while (cursor.hasNext()) { const user = cursor.next(); print(`updating user: ${user.username}`); db.users.updateOne( { _id: user._id }, { $set: { 'permissions.canCreateLinks': true }, }, ); }