Mongodb: failed to connect to server on first connect

To connect to mongodb with mongoose, you can use :

mongoose.connect('mongodb://localhost/users_test');

or

mongoose.connect('localhost/users_test');

or

mongoose.connect('localhost','users_test');

But not mongoose.connect('mongodb:localhost/users_test');, it doesnt match the right hostname (mongodb instead of localhost)

Leave a Comment