title: store files in mongodb using mongoose
body: <p>I am new with node and mongoDB. I am developing an app with nodeJS, express and mongoDB. I want read a csv/xlsx file from a file input field and store it in mongoDB using mongoose. I am having difficulties. I am using angularjs in my front end. Can anyone give me suggestions about what procedure I should go through? Specific Code will be great help.</p>
  
  <p>I used busboy module to store files in a specific folder. Here is my code</p>
  
  <p>In routes:</p>
  
  <pre><code>router.post('/fileupload', function (req, res) {
      var fstream;
      req.pipe(req.busboy);
      console.log(req.pipe);
      console.log(req.busboy);
      req.busboy.on('file', function (fieldname, file, filename) {
          console.log("Uploading: " + filename);
          fstream = fs.createWriteStream('./files/' + filename);
          file.pipe(fstream);
          fstream.on('close', function () {
              res.redirect('back');
          });
      });
  });
  </code></pre>
  
  <p>and my frontend:</p>
  
  <pre><code>&lt;form method="post" action="/fileupload" enctype="multipart/form-data"&gt;
      &lt;input type="file" id="file" name="file"&gt;
      &lt;button type="submit"&gt;Submit&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Up to now there is no error. Now i just want to store these files in database.
  What should I do next?</p>