【发布时间】:2018-11-18 06:16:02
【问题描述】:
我有一个包含 100 万个文档的集合...我已通过 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
猫鼬版本 - 5.0
【问题讨论】:
标签: node.js mongodb mongoose mongodb-query aggregation-framework