Browse Source

Updated MongoDB 5 rawCollection deprecated update to updateMany (or updateOne).

Thanks to xet7 !
Lauri Ojansivu 3 năm trước cách đây
mục cha
commit
a196a5ed63
1 tập tin đã thay đổi với 3 bổ sung3 xóa
  1. 3 3
      server/migrations.js

+ 3 - 3
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: {