title: 'mongodump' is not recognized as an internal or external command,operable program or batch file
body: <p>Here I am going to back up my MongoDB <strong>Atlas</strong> database on my <strong>MERN</strong> project. I use the below code to backup, but this message shows when I run the express server. First create mongodb_backup.js, cron.js and require the server.js file. These are all working fine. 
  And one thing that is the correct URL to give to the dbOptions.host.</p>
  
  <p><strong>mongodb_backup.js</strong></p>
  
  <pre><code>var fs = require('fs');
  var _ = require('lodash');
  var exec = require('child_process').exec;
  const path = require('path');
  const backupDirPath = path.join(__dirname, 'database-backup/');
  
  var dbOptions = {
      user: '****',
      pass: '****',
      host: 'mongodb+srv://cluster0-gtick.mongodb.net/test?retryWrites=true&amp;w=majority',
      port: 27017,
      database: 'Project-Management',
      autoBackup: true,
      removeOldBackup: true,
      keepLastDaysBackup: 2,
      autoBackupPath: backupDirPath
  };
  exports.stringToDate = dateString =&gt; {
      -------------------- all works fine
  };
  exports.empty = mixedVar =&gt; {
      ------------------------all works fine
  };
  // Auto backup function
  exports.dbAutoBackUp = () =&gt; {
      if (dbOptions.autoBackup == true) {
          let date = new Date();
          let beforeDate, oldBackupDir, oldBackupPath;
          currentDate = this.stringToDate(date);
          let newBackupDir = ------;
  
          let newBackupPath = dbOptions.autoBackupPath + '-mongodump-' + newBackupDir;
          if (dbOptions.removeOldBackup == true) {
              -------------all works fine          
          }
  
          // Command for mongodb dump process
          let cmd =
              'mongodump --host ' +
              dbOptions.host +
              ' --port ' +
              dbOptions.port +
              ' --db ' +
              dbOptions.database +
              ' --username ' +
              dbOptions.user +
              ' --password ' +
              dbOptions.pass +
              ' --out ' +
              newBackupPath;
  
          exec(cmd, (error, stdout, stderr) =&gt; {
              if (this.empty(error)) {
                  // check for remove old backup after keeping # of days given in configuration.
                  if (dbOptions.removeOldBackup == true) {
                      if (fs.existsSync(oldBackupPath)) {
                          exec('rm -rf ' + oldBackupPath, err =&gt; { });
                      }
                  }
              }
              else{
                  console.log(stderr); //here consoling the error
              }
          });
      }
  };
  </code></pre>