title: explain() in Mongodb: differences between "nscanned" and "nscannedObjects"
body: <p>I cannot get the exact difference between "nscanned" and "nscannedObjects" in the Mongodb's explain query output.</p>
  
  <p>On <a href="http://www.mongodb.org/display/DOCS/Explain" rel="noreferrer">MongoDB Explain documentation</a> I can read:</p>
  
  <blockquote>
    <p><strong>nscanned</strong> Number of items (documents or index entries) examined. Items
    might be objects or index keys. If a "covered index" is involved,
    nscanned may be higher than nscannedObjects.</p>
    
    <p><strong>nscannedObjects</strong> Number of documents scanned.</p>
  </blockquote>
  
  <p>What's the different between these two fields?
  And more specific what does exactly mean when I have a query, which uses a BtreeCursor (an index), and these two fields have two different values, for example:</p>
  
  <pre><code>{
      "cursor" : "BtreeCursor a_1_b_1",
      "isMultiKey" : false,
      "n" : 5,
      "nscannedObjects" : 5,
      "nscanned" : 9, 
      (...)
  }
  </code></pre>
  
  <p>I know what a "<a href="https://stackoverflow.com/questions/62137/what-is-a-covered-index">covered index"</a> is.
  I would like to understand exactly what the query did in the example above.
  Did it pass through ("scanned") 9 elements (nscanned = 9), where all of them are index entries and read ("examined") the value of only 5 of them (nscannedObjects = 5) to produce the result set?</p>