in app/api-service-broker/routes/mongo.js [68:83]
function(heroes, cb) {
Rate.aggregate([
{
$group: {
_id: "$heroRated",
stars: { $sum: "$rating" },
votes: { $sum: 1 }
}
},
{ $sort: { stars: -1 } }
])
.then(ratings => {
cb(null, ratings, heroes);
})
.catch(next);
}