title: MongoDB map/reduce counts
body: <p>The output from MongoDB's map/reduce includes something like <code>'counts': {'input': I, 'emit': E, 'output': O}</code>. I thought I clearly understand what those mean, until I hit a weird case which I can't explain.</p>
  
  <p>According to my understanding, <code>counts.input</code> is the number of rows that match the condition (as specified in <code>query</code>). If so, how is it possible that the following two queries have different results?</p>
  
  <pre><code>db.mycollection.find({MY_CONDITION}).count()
  
  db.mycollection.mapReduce(SOME_MAP, SOME_REDUCE, {'query': {MY_CONDITION}}).counts.input
  </code></pre>
  
  <p>I thought the two should always give the same result, independent of the map and reduce functions, as long as the same condition is used.</p>