I want to change the order of result and the format as well. The format is just like Findone(); however, I want to use aggregate function in my code. Thank you!!
My current code is like this.
db.zips.aggregate(
{$project:{ city: 1, loc: 1, pop: 1, state: 1, _id: 1}},
{$sort:{ state:1, city:1}}
)
Current Result
Goal