我收藏了一百万份文件…我已经通过了
allowDiskUse
现在它在抛出错误
TypeError: callback.apply is not a function
我已经找过了,但能找到解决办法…请帮助
const pictures = await Picture.aggregate([
{ $sort: { createdAt: -1 }},
{ $group: {
_id: { $dateToString: { format: "%Y-%m-%d", date: "$createdAt" } },
pictures: {
$push: {
_id: '$_id',
image: '$image',
time: { $dateToString: { format: "%H:%M:%S", date: "$createdAt" } }
}
}
}},
{ $limit: 50 },
{ $project: {
_id: false,
createdAt: '$_id',
pictures: '$pictures'
}}
], { allowDiskUse: true })
MongoDB版本-3.6
Mongoose版本-5.0