首页 文章

MongoError:除了带有explain参数的聚合外,'cursor'选项是必需的

提问于
浏览
3

我使用最新版本的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 回答

  • 6

    Thanks @Neil Lunn

    更新猫鼬 . 3.0之前的Mongoose版本与MongoDB 3.6不匹配 . MongoDB 3.6将聚合API从“游标可选”更改为“仅游标”,而较旧的mongoose版本通过尝试调用不推荐的方式来请求响应中的数组来打破这一点 .

相关问题