mongodb - nodejs chat example does not work -
i've come across node chat example on github, when try run it, see following error:
error connecting mongo perhaps isn't running ?
i've installed mongo 0.9.2, nodejs 5.2 pre, npm 3.0 , other dependencies. example can found here: https://github.com/gregstewart/chat.io
i can not determine whether if example not works or didn't run right. please help.
did install , start mongo-db on system? error because of missing mongo instance running on local machine.
check out follwing code excerpts chat.io.
main.js:
/** * configure user provider (mongodb connection user data storage) */ var userprovider = new userprovider('localhost', 27017); creates new userprovider object using host , port database (localhost:27017, mongo-db default).
userprovider.js:
userprovider = function(host, port) { this.db = new mongo.db('node-mongo-chat', new server(host, port, {auto_reconnect: true}, {})); this.db.addlistener('error', function(error) { console.log('error connecting mongo -- perhaps isn\'t running?'); }); this.db.open(function() { }); }; opening connection server, printing out error on failure (the error mentioned above).
consider reading on mongo-db docs concerning installation , setup here
Comments
Post a Comment