|
@@ -75,7 +75,9 @@ async function migrateTotalDoneRates() {
|
|
|
let successfulInserts = 0;
|
|
let successfulInserts = 0;
|
|
|
let batch = [];
|
|
let batch = [];
|
|
|
// 使用游标查询,不会一次性加载所有数据到内存
|
|
// 使用游标查询,不会一次性加载所有数据到内存
|
|
|
- const cursor = OldTotalDoneRate.find({}).lean().cursor();
|
|
|
|
|
|
|
+ const cursor = OldTotalDoneRate.find({ collectionName: { $in: ["20250906", "20250907"] } })
|
|
|
|
|
+ .lean()
|
|
|
|
|
+ .cursor();
|
|
|
// 逐条处理游标中的数据
|
|
// 逐条处理游标中的数据
|
|
|
for await (const doc of cursor) {
|
|
for await (const doc of cursor) {
|
|
|
// 数据结构同构,可以直接推入批次
|
|
// 数据结构同构,可以直接推入批次
|