Due to mongodb version change, i am getting "MongoError: The 'cursor' option is required, except for aggregate with the explain argument" error.
I've tried added cursor but still it is giving error.
QosAggregator.prototype.aggregatePingsByCheck = function(start, end, callback) {
Ping.aggregate(
{ $match: {
timestamp: { $gte: start, $lte: end }
} },
{ $project: {
check: 1,
responsive: { $cond: [ { $and: ["$isResponsive"] }, 1, 0] },
time: 1,
tags: 1,
} },
{ $group: {
_id: "$check",
count: { $sum: 1 },
responsiveness: { $avg: "$responsive" },
responseTime: { $avg: "$time" },
start: { $first: start.valueOf() }, // dunno any other way to set a constant
end: { $first: end.valueOf() }
} },
callback
).cursor({});
};