From b1937700cc5d57455b00a593ea34eb4513ca8ba9 Mon Sep 17 00:00:00 2001 From: Miguel Serrano Date: Wed, 5 Oct 2022 15:17:52 +0200 Subject: [PATCH] Merge pull request #9864 from overleaf/msm-fix-audit-log [scripts] fix audit log migration script GitOrigin-RevId: a7e32217385ac66a899e34eb3e0e8373bc802944 --- services/web/scripts/migrate_audit_logs.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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) }) }