mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
core: fix #806
This commit is contained in:
1 file changed
+9
-7
@@ -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();
|
||||
|
||||
Reference in new issue
Block a user