I just upgraded to node 0.5.10 from 0.4.11 and my mongoose version from 2.0.2 to 2.3.13, however I can no longer connect to localhost. My code hasn't changed at all, and I can still connect to my mongolab server. I can connect to my local db using gui (MongoHub) just by going through localhost. I now have not enough ideas. I tried the options in the following connection lines, which should both work in my version.
mongodb://localhost:27017/mydb mongodb://localhost/mydb
I even created a very simple application to simply save my local host, but to no avail. Ideas are very welcome!
var mongoose = require('mongoose'); var db = mongoose.connect('mongodb://localhost/SomeDb'); var Schema = mongoose.Schema; var Posts = new Schema({ name : String, }); mongoose.model('Post', Posts); function createNewPost(){ var Post = mongoose.model('Post'); var post = new Post({name:'new name'}); post.save(function(err){ console.log("saving"); if(!err){ console.log('Post saved.'); } }); }
henry.oswald
source share