title: How to correctly iterate through a search result in MongoDB-Shell?
body: <p>I have a MongoDB table containing 500 documents:</p>
  
  <pre><code>db.x.find().count()
  </code></pre>
  
  <p>Now I'd like to iterate over the all entries. Unfortunately the following code only gives <code>49</code>, instead of <code>500</code>:</p>
  
  <pre><code>a=0; for (s in db.x.find()) { a++; }; print(a);
  </code></pre>
  
  <p>I already increased the Number of results to <code>1000</code>:</p>
  
  <pre><code>DBQuery.shellBatchSize = 1000
  </code></pre>
  
  <p>But that did not help.</p>