title: What's the difference between update() after findOne() and direct update()?
body: <p>Suppose I have a people collection like this:</p>
  
  <pre><code>{
      {'_id': 1, 'name': 'Tom', 'age': 22}, 
      {'_id': 2, 'name': 'Joe', 'age': 30}
  }
  </code></pre>
  
  <p><em><strong>code 1:</em></strong></p>
  
  <pre><code>p = db.people.find_one({'_id': 1})
  db.people.update(p, {'$inc': {'age': 1}})
  </code></pre>
  
  <p><em><strong>code 2:</em></strong></p>
  
  <pre><code>db.people.update({'_id': 1}, {'$inc': {'age': 1}})
  </code></pre>
  
  <p>I found code 1 and code 2 are different in pymongo.
  But I don't know the difference. Can anybody tell me?</p>
  
  <p>EDIT:</p>
  
  <p>I got it.</p>
  
  <p>Json documents in pymongo are out-of-order. So <code>p = db.people.find_one({'_id': 1})</code> may not return exact the same document as document whose '_id' field's value is 1. <code>db.people.update(p, {'$inc': {'age': 1}})</code> may not find any document satisfies query p.</p>