title: How do I use Map/Reduce in MongoDB?
body: <p>I'm having trouble wrapping my head around how map/reduce works in MongoDB. I have a collection with the fields: <code>areacode, state, county, zip, city, lat, lon</code> that lists every zip code in the US along with the corresponding county, state, etc. </p>
  
  <p>I'd like to be able to query say all the counties or cities in a given state. So basically some sort of a query that looks for all records where "State=MI". In this case, there are about 900 records returned. How do I group them by county so that I just get the 83 counties for that state? I don't want to use distinct as I would like to be able to order them in alphabetical order and possibly pull out the lat/long as well.</p>
  
  <p>Any advice on how to use map/reduce to accomplish this? I feel like it's rather basic, I just can't figure it out.</p>