0

why mongoose doesn't connect to MongoHQ I am using the given URL

mongoose.connect('mongodb://' + user + ':' + pass + '@' + host + ':' + port + '/' + name)

it doesn't report any errors but nothing changes on database

Issam Zoli
  • 2,724
  • 1
  • 21
  • 35
  • I had a similar issue, my code would work when deployed (amazon s3) but wouldn't work from my dev machine. – gtsouk Mar 14 '14 at 21:02

1 Answers1

0

If you want it to report errors, you have to handle the error situation.

mongoose.connect('mongodb://' + user + ':' + pass + '@' + host + ':' + port + '/' + name', function(err) {
    if (err) throw err;
});
Mustafa
  • 10,013
  • 10
  • 70
  • 116