I'm using mongoose to call an aggregate command on a model.
User.aggregate({
$match: {
timezone: {
$in: timezones
}
}
}, {
$group: {
_id: '$timezone',
"count": {
$sum: 1
}
}
})
.exec(function (err, data) {
if (err != null) {
console.log("Error: " + err);
return;
}
// do stuff with data
});
But mongo always complains
Use of the aggregate command without the 'cursor' option is deprecated.