How can I return a count of unique values in a table? This returns an array of unique IDs...
req.models.pages.aggregate().distinct("page").get(function (err, page) {...
// returns [ '6', '92', '90', '91', '93', '94', '102' ]
// the unique ids of the individual pages
However, how can I return an object with corresponding counts? Something like...
{ '6': 2, '92':7, '90':12, etc...}
// the unique page ids with their associated counts
I see how to aggregate and I've seen how to count(), but I don't see where I can do them both together.
via Layne
No comments:
Post a Comment