title: Updating nested documents in mongodb
body: <p>Say I have a data structure something like this:</p>
  
  <pre><code>{
      'name': 'test',
      'anotherdoc': {
          'something': 'someval',
          'somenum': 1
      }
  }
  </code></pre>
  
  <p>Now, say I wanted to set something. Initially, I though it would be done like so:</p>
  
  <pre><code>collection.update({'_id': myid}, {$set: {'anotherdoc.something': 'somenewval'});
  </code></pre>
  
  <p>This, however, seems to be incorrect. It does put some data in there, but it does so in an odd manner. It would, in this case, end up like so:</p>
  
  <pre><code>[
      {
          'name': 'test',
          'anotherdoc': {
              'something': 'someval',
              'somenum': 1
          }
      },
      ['anotherdoc.something', 'someval']
  ]
  </code></pre>
  
  <p>Of course, not what I was looking for.</p>