core: script: 修复脚本回显错误的问题

This commit is contained in:
undefined committed 2021-01-22 13:41:53 +08:00
1 parent 12c43a9635
commit 6c6a0df0f0
4 files changed
+21 -16

No files matched your search

+15 -11
View File
@@ -30,18 +30,22 @@ export async function run() {
];
const bulk = db.collection('document').initializeUnorderedBulkOp();
db.collection('record').aggregate(pipeline).each(
(err, adoc: any) => bulk.find({
domainId: adoc._id.domainId,
docType: document.TYPE_PROBLEM,
docId: adoc._id.pid,
}).updateOne({
$set: {
nSubmit: adoc.nSubmit,
nAccept: adoc.nAccept,
},
}),
(err, adoc: any) => {
if (adoc) {
bulk.find({
domainId: adoc._id.domainId,
docType: document.TYPE_PROBLEM,
docId: adoc._id.pid,
}).updateOne({
$set: {
nSubmit: adoc.nSubmit,
nAccept: adoc.nAccept,
},
});
}
},
);
await bulk.execute();
if (bulk.length) await bulk.execute();
}
export const validate = {};