MongoDB group by with Mongoose
I’m using Mongoose lately to connect to a MongoDB" from a node.js app, and along the way I needed an equivalent of the mysql ‘group by’ syntax. While the MongoDB documentation contained info about how to do a group by, I couldn’t get it to work with Mongoose. After a bit of trial and error I came up with this:
Hope that helps anyone else on the same quest!