Título: Error de mongoose en nodejs Publicado por: Ali Baba en 22 Noviembre 2017, 18:54 pm Intento conectarme a mongodb desde nodejs usando mongoose y no se por que no me deja
Este es mi archivo del servidor en express: Código
este es mi archivo de configuracion de la base de datos con mongoose: Código
y este es el error que me sale en consola que no logro entender: Citar > app@1.0.0 start C:\Users\magod\Desktop\http > node server.js (node:11260) DeprecationWarning: `open()` is deprecated in mongoose >= 4.11.0, use `openUri()` instead, or set the `useMongoClient` option if using `connect()` or `createConnection()`. See http://mongoosejs.com/docs/connections.html#use-mongo-client listening... events.js:136 throw er; // Unhandled 'error' event ^ MongoError: failed to connect to server [localhostplaces:27017] on first connect [MongoError: getaddrinfo ENOTFOUND localhostplaces localhostplaces:27017] at Pool.<anonymous> (C:\Users\magod\Desktop\http\node_modules\mongodb-core\lib\topologies\server.js:336:35) at Pool.emit (events.js:159:13) at Connection.<anonymous> (C:\Users\magod\Desktop\http\node_modules\mongodb-core\lib\connection\pool.js:280:12) at Object.onceWrapper (events.js:254:19) at Connection.emit (events.js:159:13) at Socket.<anonymous> (C:\Users\magod\Desktop\http\node_modules\mongodb-core\lib\connection\connection.js:187:49) at Object.onceWrapper (events.js:254:19) at Socket.emit (events.js:159:13) at emitErrorNT (internal/streams/destroy.js:64:8) at _combinedTickCallback (internal/process/next_tick.js:138:11) at process._tickCallback (internal/process/next_tick.js:180:9) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! app@1.0.0 start: `node server.js` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the app@1.0.0 start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\magod\AppData\Roaming\npm-cache\_logs\2017-11-22T17_48_30_244Z-debug.log AUXILIOOO QUE ALGUIEN ME AYUDE POR FAVOR :( Título: Re: Error de mongoose en nodejs Publicado por: engel lex en 22 Noviembre 2017, 18:58 pm Citar (node:11260) DeprecationWarning: `open()` is deprecated in mongoose >= 4.11.0, use `openUri()` instead, or set the `useMongoClient` option if using `connect()` or `createConnection()`. See http://mongoosejs.com/docs/connections.html#use-mongo-client listening... Alerta de obsolencia: "open() está obsoleto en .... usar.... en su lugar, o ver el set.... Título: Re: Error de mongoose en nodejs Publicado por: Ali Baba en 22 Noviembre 2017, 19:05 pm Me dijeron que usara MongoClient algo asi:
Código
no entiendo que significa el objeto ese, alguien sabe? |