const tasks = []
for (let i = 0; i < batchTimes; i++) {
const promise = await aggregateInstance.replaceRoot({
newRoot: $.mergeObjects([ $.arrayElemAt(['$userInfoList', 0]), '$$ROOT' ])
})
.project({
userInfoList: 0
}).skip(i * MAX_LIMIT).limit(MAX_LIMIT).end();
tasks.push(promise)
}
console.log(tasks)
https://developers.weixin.qq.com/community/develop/article/doc/000c2869ce4980f3a71a91e775bc13
参考上面的写的,想把上面的改成一次性获取所有的task,
const MAX_LIMIT = 2
但是返回结果只有第一项