From a196a5ed63cba2b812b9e825172f3a97d9756daa Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Fri, 22 Apr 2022 16:32:28 +0300 Subject: [PATCH] Updated MongoDB 5 rawCollection deprecated update to updateMany (or updateOne). Thanks to xet7 ! --- server/migrations.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/migrations.js b/server/migrations.js index 625ec0d17..7641f516d 100644 --- a/server/migrations.js +++ b/server/migrations.js @@ -717,7 +717,7 @@ Migrations.add('add-missing-created-and-modified', () => { modifiedAtTables.map(db => db .rawCollection() - .update( + .updateMany( { modifiedAt: { $exists: false } }, { $set: { modifiedAt: new Date() } }, { multi: true }, @@ -725,7 +725,7 @@ Migrations.add('add-missing-created-and-modified', () => { .then(() => db .rawCollection() - .update( + .updateMany( { createdAt: { $exists: false } }, { $set: { createdAt: new Date() } }, { multi: true }, @@ -772,7 +772,7 @@ Migrations.add('fix-incorrect-dates', () => { .rawCollection() .find({ $or: [{ createdAt: { $type: 1 } }, { updatedAt: { $type: 1 } }] }) .forEach(({ _id, createdAt, updatedAt }) => { - t.rawCollection().update( + t.rawCollection().updateMany( { _id }, { $set: {