我使用express3.0连接mongoDb,已经运行npm install ,并在node-modules目录下看到了mongodb文件夹。我使用
var mongodb=require('../mongodb')
, mongoserver=new mongodb.Server('localhost',27017,{})
,db=new mongodb.Db('test',mongoserver,{});
连接数据库,并运行db.open(fn(req,res){}),但是返回了err对象,对象内容为failed to connect to [localhost:27017],这是怎么回事啊
7 回复
@jiyinyiyong 哦,我下载解压了mongodb windows并添加了path,执行mongo显示: connecting to test javascript excute failed :Error:couldn’t connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:L112是怎么回事啊?