title: MongoDb Aggregation - project values as keys and corresponding array value as values
body: <p>In mongodb, I have a get object in below shape after running aggregation.</p>
  
  <pre><code> {
        "_id": 1,
        "specificationList": {
          "key": "Memory &amp; Storage Features",
          "values": [
            {
              "key": "Internal Storage",
              "value": [
                "32 KB"
              ]
            },
            {
              "key": "RAM",
              "value": [
                "32 MB"
              ]
            },
            {
              "key": "Expandable Storage",
              "value": [
                "8 GB"
              ]
            },
            {
              "key": "Supported Memory Card Type",
              "value": [
                "MicroSD"
              ]
            }
          ]
        }
      }
  </code></pre>
  
  <p>From above document , how could I get object in below shape , in next aggregation pipeline. I need to get to below shape so as to make code cleaner. I am using aggregation to arrive at above shape (so want to append another pipeline), and it would be nice to know what aggregation pipeline to get at below shape</p>
  
  <pre><code>{
   "specList” : {
      “Internal Storage”: “32 KB”,
     “RAM”:”32 MB”,
     “Expandable Storage”:”8 GB”,
      “Supported Memory Card Type”:”MicroSD”
     }
  }
  </code></pre>