mongoose.connect( *Connection URL to Database here*, { useNewUrlParser: true , useCreateIndex: true, useFindAndModify: false, useUnifiedTopology:true })
Hi! Aman, I met the problem while starting to explore mongoDB as well. Hope this solves the problem! On Sunday, 26 July 2020 08:09:29 UTC+8, Aman Kr Sharma wrote: > > I am trying to connect with mongodb database but it throws some kind of > error I am unable to understand > > > (node:94165) DeprecationWarning: current Server Discovery and Monitoring > engine is deprecated, and will be removed in a future version. To use the > new Server Discover and Monitoring engine, pass option { > useUnifiedTopology: true } to the MongoClient constructor. > (Use `node --trace-deprecation ...` to show where the warning was created) > MongoNetworkError: failed to connect to server [ > cluster0-shard-00-00.lpcoo.mongodb.net:27017] on first connect > [MongoNetworkError: connection 5 to > cluster0-shard-00-00.lpcoo.mongodb.net:27017 closed > at TLSSocket.<anonymous> > (/home/aman/Documents/Coding/nodejs/expressjs_ejs_mongodb/node_modules/mongodb/lib/core/connection/connection.js:372:9) > at Object.onceWrapper (events.js:422:26) > at TLSSocket.emit (events.js:315:20) > at net.js:670:12 > at TCP.done (_tls_wrap.js:554:7)] > at Pool.<anonymous> > (/home/aman/Documents/Coding/nodejs/expressjs_ejs_mongodb/node_modules/mongodb/lib/core/topologies/server.js:438:11) > at Pool.emit (events.js:315:20) > at > /home/aman/Documents/Coding/nodejs/expressjs_ejs_mongodb/node_modules/mongodb/lib/core/connection/pool.js:562:14 > at > /home/aman/Documents/Coding/nodejs/expressjs_ejs_mongodb/node_modules/mongodb/lib/core/connection/pool.js:1009:9 > at callback > (/home/aman/Documents/Coding/nodejs/expressjs_ejs_mongodb/node_modules/mongodb/lib/core/connection/connect.js:97:5) > at > /home/aman/Documents/Coding/nodejs/expressjs_ejs_mongodb/node_modules/mongodb/lib/core/connection/connect.js:124:7 > at _callback > (/home/aman/Documents/Coding/nodejs/expressjs_ejs_mongodb/node_modules/mongodb/lib/core/connection/connect.js:349:5) > at Connection.errorHandler > (/home/aman/Documents/Coding/nodejs/expressjs_ejs_mongodb/node_modules/mongodb/lib/core/connection/connect.js:365:5) > at Object.onceWrapper (events.js:422:26) > at Connection.emit (events.js:315:20) > > > -- Job board: http://jobs.nodejs.org/ New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/37675021-7ebb-406a-b882-7de7c62f7e7eo%40googlegroups.com.