MongoDB
 SQL >> Base de données >  >> NoSQL >> MongoDB

MongoDB : failed to connect to server on first connect

Pour vous connecter à mongodb avec mongoose, vous pouvez utiliser :

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

ou

mongoose.connect('localhost/users_test'); 

ou

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

Mais pas mongoose.connect('mongodb:localhost/users_test');, cela ne correspond pas au bon nom d'hôte (mongodb au lieu de localhost).