In Mongo, how do I only display documents with the highest value for a key that they share?
问题 Say I have the following four documents in a collection called "Store": { item: 'chair', modelNum: 1154, votes: 75 } { item: 'chair', modelNum: 1152, votes: 16 } { item: 'table', modelNum: 1017, votes: 24 } { item: 'table', modelNum: 1097, votes: 52 } I would like to find only the documents with the highest number of votes for each item type. The result of this simple example would return modelNum: 1154 and modelNum: 1097. Showing me the most popular model of chair and table, based on the