I'm having trouble connecting mongodb to my local machine. I'm new at this and can't seem to figure it out from the docs or other stackoverflow posts.
I have a database.js file, and I think my connection string is wrong:
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost');
// I've tried this too:
// mongoose.connect('mongodb://localhost/test');
// mongoose.connect('mongodb://localhost:8080/test');
module.exports = {
'url' : 'mongodb://localhost:27017/test'
}
I've got mongod running in one tab and shows 4 connections open - I don't know if it's this or the connection string.
Then in a 2nd tab, I've connected to a db called "test".
Lastly there's a very simple view. When I navigate to localhost:8080 (where process.env.PORT || 8080 is pointing to in server.js), it doesn't connect.