I am trying to connect with mongodb database but it throws some kind of error I am unable to understand

77 views
Skip to first unread message

Aman Kr Sharma

unread,
Jul 25, 2020, 8:09:29 PM7/25/20
to nodejs
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)


Rahul Deewan

unread,
Jul 27, 2020, 10:24:19 AM7/27/20
to nod...@googlegroups.com

Hi,

I think MongoDb installed on your system is not running. Please run that first and then try to execute the program.



--
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+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/687e014b-34fd-415e-b5b6-8d92a559c131o%40googlegroups.com.


--
Regards
Rahul Deewan

Zlatko

unread,
Jul 27, 2020, 10:24:19 AM7/27/20
to nodejs
Hi there,


On Sunday, July 26, 2020 at 2:09:29 AM UTC+2, Aman Kr Sharma wrote:


(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


What is your exact connection string? If you just pass "cluster0-shard-00-00.lpcoo.mongodb.net:27017", try adding `mongodb://` before it. But MongoNetworkError seems to indicate that your _server_ is either down or unreachable. Can you reach it from another MongoDB client? Is the error only in your app?

Choo Tze Sien

unread,
Jul 27, 2020, 10:24:19 AM7/27/20
to nodejs
mongoose.connect( *Connection URL to Database here*, { useNewUrlParsertrueuseCreateIndextrueuseFindAndModifyfalseuseUnifiedTopology:true })

Hi! Aman, I met the problem while starting to explore mongoDB as well. Hope this solves the problem!

Sanjay Sharma

unread,
Jul 27, 2020, 10:24:19 AM7/27/20
to nodejs
Reply all
Reply to author
Forward
0 new messages