mongo error

#15 · closed · 2 comments

View on GitHub ↗

invisiblecoder99

npm start > [email protected] start /root/chat.io > node server.js (node:14927) 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 { "date": "Tue Jul 03 2018 14:51:34 GMT+0000 (UTC)", "process": { "pid": 14927, "uid": 0, "gid": 0, "cwd": "/root/chat.io", "execPath": "/root/.nvm/versions/node/v8.11.3/bin/node", "version": "v8.11.3", "argv": [ "/root/.nvm/versions/node/v8.11.3/bin/node", "/root/chat.io/server.js" ], "memoryUsage": { "rss": 66256896, "heapTotal": 56217600, "heapUsed": 26144704, "external": 18695889 } }, "os": { "loadavg": [ 0.0751953125, 0.05517578125, 0.06396484375 ], "uptime": 1518 }, "trace": [ { "column": 35, "file": "/root/chat.io/node_modules/mongoose/node_modules/mongodb-core/lib/topologies/server.js", "function": null, "line": 336, "method": null, "native": false }, { "column": 13, "file": "events.js", "function": "emitOne", "line": 116, "method": null, "native": false }, { "column": 7, "file": "events.js", "function": "Pool.emit", "line": 211, "method": "emit", "native": false }, { "column": 12, "file": "/root/chat.io/node_modules/mongoose/node_modules/mongodb-core/lib/connection/pool.js", "function": null, "line": 280, "method": null, "native": false }, { "column": 30, "file": "events.js", "function": "Object.onceWrapper", "line": 317, "method": "onceWrapper", "native": false }, { "column": 13, "file": "events.js", "function": "emitTwo", "line": 126, "method": null, "native": false }, { "column": 7, "file": "events.js", "function": "Connection.emit", "line": 214, "method": "emit", "native": false }, { "column": 49, "file": "/root/chat.io/node_modules/mongoose/node_modules/mongodb-core/lib/connection/connection.js", "function": null, "line": 187, "method": null, "native": false }, { "column": 30, "file": "events.js", "function": "Object.onceWrapper", "line": 315, "method": "onceWrapper", "native": false }, { "column": 13, "file": "events.js", "function": "emitOne", "line": 116, "method": null, "native": false }, { "column": 7, "file": "events.js", "function": "Socket.emit", "line": 211, "method": "emit", "native": false }, { "column": 8, "file": "internal/streams/destroy.js", "function": "emitErrorNT", "line": 64, "method": null, "native": false }, { "column": 11, "file": "internal/process/next_tick.js", "function": "_combinedTickCallback", "line": 138, "method": null, "native": false }, { "column": 9, "file": "internal/process/next_tick.js", "function": "process._tickCallback", "line": 180, "method": "_tickCallback", "native": false } ], "stack": [ "MongoError: failed to connect to server [<MongoDBHost>:27017] on first connect [MongoError: getaddrinfo ENOTFOUND <MongoDBHost> <MongoDBHost>:27017]", " at Pool.<anonymous> (/root/chat.io/node_modules/mongoose/node_modules/mongodb-core/lib/topologies/server.js:336:35)", " at emitOne (events.js:116:13)", " at Pool.emit (events.js:211:7)", " at Connection.<anonymous> (/root/chat.io/node_modules/mongoose/node_modules/mongodb-core/lib/connection/pool.js:280:12)", " at Object.onceWrapper (events.js:317:30)", " at emitTwo (events.js:126:13)", " at Connection.emit (events.js:214:7)", " at Socket.<anonymous> (/root/chat.io/node_modules/mongoose/node_modules/mongodb-core/lib/connection/connection.js:187:49)", " at Object.onceWrapper (events.js:315:30)", " at emitOne (events.js:116:13)", " at Socket.emit (events.js:211:7)", " 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)" ], "level": "error", "message": "uncaughtException: failed to connect to server [<MongoDBHost>:27017] on first connect [MongoError: getaddrinfo ENOTFOUND <MongoDBHost> <MongoDBHost>:27017]" }

Comments

anurakt27

Did anyone find solution yet ?

jebraili

in index.js file inner database directory set useMongoClient true `Mongoose.connect(dbURI, { useMongoClient: true });`