学习过程中,下了坛子的源码,windows下没跑成功,装了个Ubuntu,终于搞成下面的样子,谷歌而不知所云了,求教诸位。另,看Node.js指南到现在一直遇到蛋疼的版本问题,折磨啊。
> tanmo[@ubuntu](/user/ubuntu):~/nodeclub-master$ node app.js
======================================================================================== = Please ensure that you set the default write concern for the database by setting = = one of the options = = = = w: (value of > -1 or the string ‘majority’), where < 1 means = = no write acknowlegement = = journal: true/false, wait for flush to journal before acknowlegement = = fsync: true/false, wait for flush to file system before acknowlegement = = = = For backward compatibility safe is still supported and = = allows values of [true | false | {j:true} | {w:n, wtimeout:n} | {fsync:true}] = = the default value is false which means the driver receives does not = = return the information of the success/error of the insert/update/remove = = = = ex: new Db(new Server(‘localhost’, 27017), {safe:false}) = = = = http://www.mongodb.org/display/DOCS/getLastError+Command = = = = The default of no acknowlegement will change in the very near future = = = = This message will disappear when the default safe is set on the driver Db =
NodeClub listening on port 3000 in development mode God bless love… You can debug your app with http://localhost.cnodejs.org:3000
4 回复
是不是没设置数据库啊,没设置数据库或者没打开数据库,启动都会报错的
我也遇到这种问题。
我改成这样子
module.exports = new Db('microblog',new Server('localhost', 27017), { w: 1 });
唉,搞定了,原来试地址错了,这个http://localhost:3000/就行了