title: How to optimize queries that return large data?
body: <p>I have about 10 documents on MongoDB. Every document pertains to an image, and contains that image's binary data.</p>
  
  <p>Running a mongoose query like <code>Image.find()</code> returns an error, </p>
  
  <pre><code>Error.captureStackTrace(this, this.constructor);
              ^
  
  TypeError: Error.captureStackTrace is not a function
  </code></pre>
  
  <p>Rerunning the query as <code>Image.find().limit(10);</code> takes 22 seconds.</p>
  
  <p>The query <code>Image.find().limit(3);</code> takes 4 (oddly enough, considering one would expect it to run in no less than ~7, if 10 records take 22 seconds).</p>
  
  <p>Anyway, I'm wondering what I can do here. Other than hosting the images on something like S3, of course.</p>
  
  <p>What could be nice, is I could take this opportunity to implement pagination.. But what user would want to wait 4 seconds per page?</p>
  
  <p>Any thoughts/suggestions? This would also kill the client if I store this large data in the state.</p>