简体   繁体   中英

MongoDb Connection Error when using Mongoose

I did not have a problem connecting to Atlas previously from my wifi at home. But I have issues at Starbucks. I have now switched to google fiber and I am getting this error.

    at Pool.<anonymous> (/Users/j/Desktop/projects/templateApp/node_modules/mongodb-core/lib/topologies/server.js:431:11)
    at Pool.emit (events.js:182:13)
    at connect (/Users/j/Desktop/projects/templateApp/node_modules/mongodb-core/lib/connection/pool.js:557:14)
    at callback (/Users/j/Desktop/projects/templateApp/node_modules/mongodb-core/lib/connection/connect.js:109:5)
    at runCommand (/Users/j/Desktop/projects/templateApp/node_modules/mongodb-core/lib/connection/connect.js:129:7)
    at Connection.errorHandler (/Users/j/Desktop/projects/templateApp/node_modules/mongodb-core/lib/connection/connect.js:321:5)
    at Object.onceWrapper (events.js:273:13)
    at Connection.emit (events.js:182:13)
    at TLSSocket.<anonymous> (/Users/j/Desktop/projects/templateApp/node_modules/mongodb-core/lib/connection/connection.js:350:12)
    at Object.onceWrapper (events.js:273:13)
    at TLSSocket.emit (events.js:182:13)
    at _handle.close (net.js:596:12)
    at TCP.done [as _onclose] (_tls_wrap.js:383:7)
  name: 'MongoNetworkError',
  errorLabels: [ 'TransientTransactionError' ],```

I have checked my strings and they are correct. 

My connection code is: 

```mongoose.connect(process.env.dataBaseConnection, {
  dbName: process.env.dataBaseName,
  useFindAndModify: false,
  useNewUrlParser: true
});```

问题是我需要将新的IP地址列入白名单。

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