title: MongoDB transform array of objects into array of field values
body: <p>I got a field which is an Array of objects inside another array of object in below format</p>
  <pre><code>{
   id: '1234567',
   listOfSettings: [{
    name: 'setting1',
    listOfObjects: [{name: 'object1',id:'111'}, {name: 'object2', id: '112'}]
   }, {
    name: 'setting2',
    listOfObjects: [{name: 'object2',id:'113'}, {name: 'object3', id: '114'}]
   }]
  }
  </code></pre>
  <p>I want to convert it with a Mongo update query into something like:</p>
  <pre><code>{
    id: '1234567',
    listOfSettings:[{
     name: 'settings1',
     listOfObjects:['111', '112']
    }, {
     name: 'settings2',
     listOfObjects:['113', '114']
    }]
  }
  </code></pre>
  <p>I know I can use the $set option to update the content and $fieldname to specify the field to obtain values, but not sure how I can achieve it in case of nested arrays.</p>