我使用最新版本的mongodb 3.6即使在收到以下错误后......
MongoError: The 'cursor' option is required, except for aggregate with the explain argument
const user = await User.aggregate([
{ $group: {
_id: '$_id',
domain: { $push: "$domain" },
domain: { $push: "$email" },
domain: { $push: "$userName" }
}
}
])
1 回答
Thanks @Neil Lunn
更新猫鼬 . 3.0之前的Mongoose版本与MongoDB 3.6不匹配 . MongoDB 3.6将聚合API从“游标可选”更改为“仅游标”,而较旧的mongoose版本通过尝试调用不推荐的方式来请求响应中的数组来打破这一点 .