Database

[{_id:"01035",city:"CITY 1",pop:4231,state:"STATE 1"},{_id:"01036",city:"CITY 2",pop:10545,state:"STATE 1"},{_id:"01037",city:"CITY 3",pop:5478,state:"STATE 2"},{_id:"01038",city:"CITY 4",pop:6387,state:"STATE 1"},{_id:"01039",city:"CITY 5",pop:27870,state:"STATE 2"},]

Query

db.collection.aggregate([{$sort:{pop:-1}},{$group:{_id:"$state",city:{$first:"$city"},population:{$first:"$pop"}}}])

Result