title: How to store binary data (PNG) in MongoDB via Mongoose?
body: <p>I'm working on a site with a MEAN stack scaffolded from this yeoman.io generator: <a href="https://github.com/DaftMonk/generator-angular-fullstack" rel="nofollow">https://github.com/DaftMonk/generator-angular-fullstack</a>, and I'm trying to upload some image files to MongoDB in binary form. Here is my git repo for the project:</p>
  
  <p><a href="https://github.com/peter-atlanta/personal-site" rel="nofollow">https://github.com/peter-atlanta/personal-site</a></p>
  
  <p>I've followed @aheckmann's GIST to a tee: <a href="https://gist.github.com/aheckmann/2408370" rel="nofollow">https://gist.github.com/aheckmann/2408370</a>,</p>
  
  <p>But I keep getting errors about how my files can't be found, i.e.</p>
  
  <pre><code>Error: ENOENT, no such file or directory '../../client/assets/images/github.png'
      at Error (native)
      at Object.fs.openSync (fs.js:500:18)
      at Object.fs.readFileSync (fs.js:352:15)
      at Immediate.&lt;anonymous&gt; (/Users/peterward/petergrayward/blog/server/config/imageToMongo.js:43:21)
      at Immediate._onImmediate    (/Users/peterward/petergrayward/blog/node_modules/mongoose/node_modules/mquery/lib/utils.js:137:16)
      at processImmediate [as _immediateCallback] (timers.js:358:17)
  </code></pre>
  
  <p>Clearly, though, the png in question is located in that directory, and I've even tried moving the directory server-side to no avail. </p>
  
  <p>Why can't a file/directory entry-point be found? </p>