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