title: MongoDB update replaces document
body: <p>I'm trying to update a MongoDB document via PHP.
  My problem is that the documents data are removed when i update, thus other data than what I update is gone.</p>
  
  <p>Before I update, the document looks like this:</p>
  
  <pre><code>{
      "_id": {
          "$oid": "4e178b45419866350f000001"
      },
      "Twitter": {
          "_id": {
              "$oid": "4e178b45419866350f000000"
          },
          "created": {
              "$date": "2011-07-08T22:57:09Z"
          },
          "userid": "5552362"
      },
      "created": {
          "$date": "2011-07-08T22:57:09Z"
      }
  }
  </code></pre>
  
  <p>Here's how I update:</p>
  
  <pre><code>    $r = $Profile-&gt;update(
          array('Twitter._id' =&gt; new MongoId($profile['_id'])),
          array(
              '$set' =&gt; array(
                  'Twitter' =&gt; array(
                      'name' =&gt; $user['name'],
                      'username' =&gt; $user['screen_name'],
                      'url' =&gt; $user['url'],
                      'modified' =&gt; new MongoDate()
                  )
              )
          ),
          array('safe' =&gt; true)
      );
      debug($r); 
  </code></pre>