简体   繁体   中英

Mongodb is giving connection errors

I have the MongoDB up and running and after some time of working perfectly fine, it throws the error mentioned below. Does anyone have an idea why this is happening? Any help is appreciated. Thanks!

EDIT: Just ran the code again and MongoDB was able to connect. Not sure why this is happening.

failed to connect to server[test - shard - 00 - 02 - ocunf.mongodb.net: 27017]on first connect[MongoNetworkError: connection 5 to test - shard - 00 - 02 - ocunf.mongodb.net: 27017 closed
at TLSSocket.<anonymous>(D: \dev\contactkeeper\node_modules\mongodb - core\lib\connection\connection.js: 352: 9)
at Object.onceWrapper(events.js: 288: 20)
at TLSSocket.emit(events.js: 200: 13)
at net.js: 586: 12
at TCP.done(_tls_wrap.js: 478: 7) {
    name: 'MongoNetworkError',
        errorLabels: [Array],
            [Symbol(mongoErrorContextSymbol)]: { }
}]

I guess you are using Mongo Atlas. You should whitelist your IP address: Security => IP Whitelist. Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM