gpt4 book ai didi

node.js - MongoError : The 'cursor' option is required, 除了带有解释参数的聚合

转载 作者:可可西里 更新时间:2023-11-01 09:19:39 55 4
gpt4 key购买 nike

即使出现以下错误,我仍在使用最新版本的 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" }
}
}
])

最佳答案

感谢@Neil Lunn

更新 Mongoose 。 5.0 之前的 Mongoose 版本与 MongoDB 3.6 不正确匹配。 MongoDB 3.6 将聚合 API 从“游标可选”更改为“仅游标”,而较旧的 Mongoose 版本通过尝试调用一种已弃用的方式来请求数组作为响应来打破这一点。

关于node.js - MongoError : The 'cursor' option is required, 除了带有解释参数的聚合,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50101104/

55 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com