This commit is contained in:
undefined committed 2024-05-12 17:48:37 +08:00
1 parent 2df9435eb7
commit bb87ecbfcf
1 file changed
+2
+2
View File
@@ -657,6 +657,7 @@ const scripts: UpgradeScript[] = [
let bulk = RecordModel.collStat.initializeUnorderedBulkOp(); let bulk = RecordModel.collStat.initializeUnorderedBulkOp();
for await (const doc of cursor) { for await (const doc of cursor) {
bulk.find({ _id: doc._id }).upsert().updateOne({ bulk.find({ _id: doc._id }).upsert().updateOne({
$set: {
domainId: doc.domainId, domainId: doc.domainId,
pid: doc.pid, pid: doc.pid,
uid: doc.uid, uid: doc.uid,
@@ -664,6 +665,7 @@ const scripts: UpgradeScript[] = [
memory: doc.memory, memory: doc.memory,
length: doc.code?.length || 0, length: doc.code?.length || 0,
lang: doc.lang, lang: doc.lang,
},
}); });
if (bulk.batches.length > 500) { if (bulk.batches.length > 500) {
await bulk.execute(); await bulk.execute();