Cannot connect to local DB
petre2dor opened this issue · 1 comments
db.js contains:
module.exports = { url : 'mongodb://localhost/test' }
and I have mongodb installed: $ mongo --version MongoDB shell version: 2.4.6
when is start node server.js
I get this:
connect.multipart() will be removed in connect 3.0 visit https://github.com/senchalabs/connect/wiki/Connect-3.0 for alternatives connect.limit() will be removed in connect 3.0 The magic happens on port 8080 events.js:72 throw er; // Unhandled 'error' event ^ Error: failed to connect to [localhost:27017] at null.<anonymous> (/home/petre/Documents/work/starter-node-angular/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:553:74) at EventEmitter.emit (events.js:106:17) at null.<anonymous> (/home/petre/Documents/work/starter-node-angular/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:140:15) at EventEmitter.emit (events.js:98:17) at Socket.<anonymous> (/home/petre/Documents/work/starter-node-angular/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection.js:512:10) at Socket.EventEmitter.emit (events.js:95:17) at net.js:440:14 at process._tickCallback (node.js:415:13)
What am I missing?
Thanks for the tutorial and the project!
Petre
I ran into the same problem initially!
Before starting node, go to the top level directory of your project and type
mongod
then run node server.js.
My bet is that it is trying to connect to mongo but mongo is not yet running.