如何使用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 –