title: MongoDB - Update in second level array
body: <p>I have the following structure:</p>
  
  <pre><code> document: {
      'data': {
          'field_1': 'blabla',
          'field_2': 'blabla++',
          'interesting_field': [
               {
                   'f_1': 'abc',
                   'this_is_interesting': [
                        {
                           'a1': 'text',
                           'a2': 'other_text'
                        },
                        {
                           'a1': 'text 2',
                           'a2': 'text 3'
                        }
                   ]
               },
               'etc': 'etc'
          ]
      },
      'somthing_boring': 'bla'
   }
  </code></pre>
  
  <p>What I need to do is update all 'a2' from 'this_is_interesting' from 'interesting_field' fields (if they match a certain criteria).</p>
  
  <p>To update in a level 1 array, I can do something like:</p>
  
  <pre><code>{
    '_id': new ObjectId('5621020d78946ac20a000021'), 
    'data.interesting_field' : {
      $elemMatch : {
          'f_1' : 'abc'
      }
    }
  },
  {$set: {'data.interesting_field.$.something_to_update': 'something'}}
  </code></pre>
  
  <p>But... seems I can't use match for level 2+ arrays. Any ideas how to do this? (was thinking of a mapReduce... but don't think I can use it in an update query).</p>