title: mongoexport with parameters + node.js + child process
body: <p>I am trying to export a csv using node.js from mongodb. For this i started with this code:</p>
  
  <pre><code>app.get('/export', function(req, res) {
   var spawn = require('child_process').spawn,
   ls = spawn('mongoexport');
  res.sendfile('/home/database.csv'); 
  });
  </code></pre>
  
  <p>And this works fine. Then for making it more usable i tried to code below with mongoexport using arguments:</p>
  
  <pre><code> app.get('/export', function(req, res) {
   var spawn = require('child_process').spawn,
   ls = spawn('mongoexport --db lms --collection databases --fields firstname,lastname,email,daytimePhone,addressOne,city,state,postalCode,areaOfStudy,currentEducationLevel,company --csv --out /home/database.csv');
  res.sendfile('/home/database.csv') 
  
  });
  </code></pre>
  
  <p>This throws a exception:</p>
  
  <pre><code>events.js:72
          throw er; // Unhandled 'error' event
                ^
  Error: spawn ENOENT
      at errnoException (child_process.js:980:11)
      at Process.ChildProcess._handle.onexit (child_process.js:771:34)
  </code></pre>
  
  <p>Then i tried using only one argument but it gives the same error :(</p>
  
  <p>I tried this also to see if arguments work this way but the same error:</p>
  
  <pre><code>spawn('mongoexport',['--csv']);
  </code></pre>