Mongodb(版本3.6)聚合不起作用 . 以前我使用的是mongodb 3.4和mongoose 4.7.0 .
Books.aggregate([{
$match: filter
}, {
$lookup: {
from: 'users',
localField: 'user_id',
foreignField: '_id',
as: 'user'
}
}], function(err, list) {
上面的代码与mongodb 3.4一起工作正常 . 但是在将mongodb更新到3.6后,聚合不起作用 . 它会引发以下错误
The 'cursor' option is required, except for aggregate with the explain argument
由于很多依赖,我也无法更新mongoose . 那么有没有办法用mongoose 4.7.0解决这个问题?
1 回答
AGGREGATIONCURSOR Cannot directly be instantiated
例