title: How to loop through and read all documents in a MongoDB collection?
body: <p>My <code>xyz_services</code> collection has three documents:</p>
  
  <pre><code>xyz_services
  
  {
      service: "XYZ for under 1,500 sqft properties",
      minSize: 0,
      maxSize: 1500,
      price: 100,
      _id: "9LnnnJx3itBts8Bgp"
  }
  {
      service: "XYZ for 1,501 - 2,000 sqft properties",
      minSize: 1501,
      maxSize: 2000,
      price: 125,
      _id: "kmMnxuBfB2Qimdwkc"
  }
  {
      service: "XYZ for 2,001 - 3,000 sqft properties",
      minSize: 2001,
      maxSize: 3000,
      price: 150,
      _id: "jE8cPwRwkPmvRqZdB"
  }
  </code></pre>
  
  <p>I get an integer <code>size</code> from a form submission. </p>
  
  <p>Say that <code>var size = 2500</code></p>
  
  <p>I need to loop through each of the three individual documents in this <code>xyz_services</code> collection and see which document matches</p>
  
  <p><code>minSize &lt;= size &lt;= maxSize</code></p>
  
  <p>After I find the match I need to grab the <code>price</code> value from the document.</p>
  
  <p>( In this case, for size = 2500, price would be 150 )</p>
  
  <p>I'm totally uncertain how to write this - there's another SO question about looping through documents but I'm afraid it's over my head.</p>
  
  <p>Can anyone help me with the code?</p>