I cannot get a result with aggregation option parameter. Here is my aggregation:-
var emails = getAllEmails();
var listMatchColl = 'list_matches_' + insertedId;
SurveyDL.aggregate([
{ $match: { email: { $in: emails } } },
{ $out: listMatchColl }
], {
allowDiskUse: true
}).exec(function(err, data) {
if (err) return console.log('err', err);
console.log('data',data);
});
}
When i execute above code it thrown and error i.e,
Error: Arguments must be aggregate pipeline operators at Aggregate.append (/home/vivek/nrich/node_modules/mongoose/lib/aggregate.js:89:11) at new Aggregate (/home/vivek/nrich/node_modules/mongoose/lib/aggregate.js:48:17)
I have also use the alternative way but it still throw same error. Alternative way :-
var emails = getAllEmails();
var listMatchColl = 'list_matches_' + insertedId;
SurveyDL.aggregate([
{ $match: { email: { $in: emails } } },
{ $out: listMatchColl }
], {
allowDiskUse: true
},function(err, data) {
if (err) return console.log('err', err);
console.log('data',data);
});
所有评论(0)