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(); 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({
domainId: doc.domainId, $set: {
pid: doc.pid, domainId: doc.domainId,
uid: doc.uid, pid: doc.pid,
time: doc.time, uid: doc.uid,
memory: doc.memory, time: doc.time,
length: doc.code?.length || 0, memory: doc.memory,
lang: doc.lang, length: doc.code?.length || 0,
lang: doc.lang,
},
}); });
if (bulk.batches.length > 500) { if (bulk.batches.length > 500) {
await bulk.execute(); await bulk.execute();