我收到mongo错误,以下是我的aggregation.i在没有光标的情况下尝试过,它给了我 错误就像'cursor'选项是必需的,除了带有explain参数的聚合。后 addind游标给了我不同的错误,例如Arguments必须是聚合管道运算符
var mongoose = require('mongoose');
var matches = mongoose.model('matches');
var userjoinings = mongoose.model('userjoinings');
module.exports = (function(){
return{
getAllUpcomingMatches:function(request,response){
var arr = new Array();
arr.push({$match:{username:request.body.username,mobilenumber:request.body.mobilenumber}})
arr.push( {$lookup:{ from: userjoinings,localField: 'matchId', foreignField: "matchId", as: "match_data"}})
arr.push({$match:{match_data:[]}})
matches.aggregate(arr,{"allowDiskUse":true},{cursor:{batchSize: 1000}},function(result){
if(result){
response.json(result)
} else {
response.send(error)
}
})
}
})
请帮助我。