MongoDB聚合$lookup以及游标和管道错误

MongoDB聚合$lookup以及游标和管道错误,mongodb,mongoose,aggregation-framework,Mongodb,Mongoose,Aggregation Framework,我正在尝试运行此聚合,以针对MongoDB使用Mongoose创建持久连接: await HourLog.aggregate([ { $lookup: { from: 'timeentries', localField: '_id', foreignField: 'hourLog', as: 'timeEntries' } }, { $out: 'hourlogs' } ]); 使用Mongo版本3.6.6和Mongoose版本4.8.7 我得到这个

我正在尝试运行此聚合,以针对MongoDB使用Mongoose创建持久连接:

await HourLog.aggregate([
{
  $lookup: {
    from: 'timeentries',
    localField: '_id',
    foreignField: 'hourLog',
    as: 'timeEntries'
  }
},
  { $out: 'hourlogs' }
]);
使用Mongo版本3.6.6和Mongoose版本4.8.7

我得到这个错误:

Error: The 'cursor' option is required, except for aggregate with the explain argument
我尝试添加光标选项:

  await HourLog.aggregate([
{
  $lookup: {
    from: 'timeentries',
    localField: '_id',
    foreignField: 'hourLog',
    as: 'timeEntries'
  }
},
  { $out: 'hourlogs' }
], { $cursor: { } });
但我有一个新的错误:

Error: Arguments must be aggregate pipeline operators
有什么想法吗?

将您的版本更新为5.x的可能副本