"' mongoimport'不被视为内部或外部命令"使用mongojs创建数据库时

时间:2014-08-04 19:04:06

标签: javascript node.js mongodb

如何使用mongojs创建数据库? 我试图运行命令,但有错误...

var db = require('mongojs').connect('learn', ['mikecollection']),
    mycollection = db.collection('mikecollection'),
    query_results,
    data = require('./data.json'),
    sys = require('sys');

var util = require('util'),
    exec = require('child_process').exec,
    child;

child = exec('mongoimport --db mikeDB --collection mycol --file "A:\Users\Mike\Desktop\nodejs\2_temp\data.json"',
  function (error, stdout, stderr) {
      console.log('stdout: ' + stdout);
      console.log('stderr: ' + stderr);
      if (error !== null) {
          console.log('exec error: ' + error);
      }
  });

错误:

Error: Command failed: 'mongoimport' is not recognized as an internal or external command – 

0 个答案:

没有答案