diff --git a/services/web/scripts/migrate_audit_logs.js b/services/web/scripts/migrate_audit_logs.js index baf40f7629..1636595a87 100644 --- a/services/web/scripts/migrate_audit_logs.js +++ b/services/web/scripts/migrate_audit_logs.js @@ -89,10 +89,12 @@ async function processUsersBatch(users, options) { } await promiseMapWithLimit(options.writeConcurrency, users, async user => { - const projects = await db.projects.find( - { owner_ref: user._id, auditLog: { $exists: true } }, - { _id: 1, auditLog: 1 } - ) + const projects = await db.projects + .find( + { owner_ref: user._id, auditLog: { $exists: true } }, + { _id: 1, auditLog: 1 } + ) + .toArray() await processProjectsBatch(projects, options) }) }