title: How to Change output format when using group in aggregation mongodb
body: <p>I Need to change the out put format of following mongodb query.  </p>
  
  <p><strong>Query</strong>  </p>
  
  <pre><code> db.Response.aggregate([{
         "$match": {
           "$and": [{
             "job_details.owner_id" : 482,
           }, {
             "job_details.owner_type" : 'searches',
           }],
         },
     }, 
     {
        "$group": {
           "_id": "$candidate_sublocation_name_string",
           "count": {
             "$sum": 1,
           },
        },
     }])
  </code></pre>
  
  <p><strong>Actual Out Put</strong></p>
  
  <pre><code>{ "_id" : "Central Delhi ", "count" : 1 }
  { "_id" : "Adyar ", "count" : 1 }
  { "_id" : "Bommanahalli", "count" : 2 }
  { "_id" : "DLF Phase 3 ", "count" : 2 }
  { "_id" : "Aai Colony", "count" : 1 }
  </code></pre>
  
  <p><strong>Needed Out Put</strong></p>
  
  <pre><code> { "Central Delhi" : 1 }
      { "Adyar" : 1 }
      { "Bommanahalli" : 2 }
      { "DLF Phase 3 ": 2 }
      { "Aai Colony": 1 }
  </code></pre>
  
  <p>Is it possible to change the out put format like this..?  </p>