(report: Report)
| 330 | } |
| 331 | |
| 332 | async function fixProblem(report: Report) { |
| 333 | const count = await dst.collection('document').countDocuments({ docType: 10 }); |
| 334 | await report({ progress: 1, message: `Fix pid: ${count}` }); |
| 335 | const total = Math.floor(count / 50); |
| 336 | for (let i = 0; i <= total; i++) { |
| 337 | const docs = await dst.collection('document') |
| 338 | .find({ docType: 10 }).skip(i * 50).limit(50) |
| 339 | .toArray(); |
| 340 | for (const doc of docs) { |
| 341 | await fix(doc).catch((e) => report({ message: `${e.toString()}\n${e.stack}` })); |
| 342 | } |
| 343 | await report({ progress: Math.round(100 * ((i + 1) / (total + 1))) }); |
| 344 | } |
| 345 | } |
| 346 | |
| 347 | function objid(ts: Date) { |
| 348 | const p = Math.floor(ts.getTime() / 1000).toString(16); |
no test coverage detected