Im Working With Mongodb And Wanted to do a query using Aggregate fucntion. Query Is Each city has several zip codes. Find the city in each state with the most number of zip codes and rank those cities along with the states using the city populations.

The documents are in the following format

  "_id": "10280",
  "city": "NEW YORK",
  "state": "NY",
  "pop": 5574,
  "loc": [

I was able to count no of Zipcodes for each state using below command


Zips is name of collection

What should be my approach to solve the query?