J'ai suivi ce tutoriel: http://howtonode.org/express-mongodbÉchec de la connexion à mongodb dans ubuntu?
Son étrange, la première fois que j'ai suivi le tutoriel tout a fonctionné. Mais maintenant, un jour après je voulais jouer à nouveau avec le code, je ne pouvais pas démarrer le serveur. C'est ce que j'ai:
[email protected]:~/blog2$ node app.js Express server listening on port 3000 in development mode
node.js:134 throw e; // process.nextTick error, or 'error' event on first tick ^Error: failed to connect to [localhost:27017] at [object Object]. (/home/alex/blog2/node_modules/mongodb/lib/mongodb/connection/server.js:189:47) at [object Object].emit (events.js:67:17) at [object Object]. (/home/alex/blog2/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:110:14) at [object Object].emit (events.js:67:17) at Socket. (/home/alex/blog2/node_modules/mongodb/lib/mongodb/connection/connection.js:301:10) at Socket.emit (events.js:64:17) at Array. (net.js:836:27) at EventEmitter._tickCallback (node.js:126:26) [email protected]:~/blog2$
Des suggestions pour résoudre ce problème?
EDIT:
Je viens de faire:
[email protected]:~/blog2$ sudo service mongodb start
mongodb start/running, process 9847
[email protected]:~/blog2$ sudo service mongodb status
mongodb stop/waiting
[email protected]:~/blog2$
Je ne sais pas si elle est en cours d'exécution.
et c'est ce que je reçois si je tape $ mongo
dans la ligne de commande:
[email protected]:~/blog2$ mongo
MongoDB shell version: 1.8.2
Tue Nov 15 08:09:50 *** warning: spider monkey build without utf8 support. consider rebuilding with utf8 support
connecting to: test
Tue Nov 15 08:09:50 Error: couldn't connect to server 127.0.0.1 shell/mongo.js:79
exception: connect failed
Etes-vous sûr MongoDB est en cours d'exécution? Il semble que le noeud ne puisse pas s'y connecter. –
@Tim Veuillez voir mon ** EDIT **. – alexchenco