我正在尝试将我的react-app服务器连接到mongoDB地图集。 我已将我的IP列入白名单,并在数据库中建立了一个用户 在尝试连接到数据库时,它一直给我这个错误: 几次随机猫鼬将服务器连接到数据库,但是当尝试再次将数据获取或发布到数据库时,猫鼬超时并停止工作。 有人知道为什么会这样吗?
[0] MongooseError [MongooseTimeoutError]: Server selection timed out after 30000 ms
[0] at new MongooseTimeoutError (/Users/shadan/Desktop/jewlss/backend/pishkesh/node_modules/mongoose/lib/error/timeout.js:22:11)
[0] at NativeConnection.Connection.openUri (/Users/shadan/Desktop/jewlss/backend/pishkesh/node_modules/mongoose/lib/connection.js:763:19)
[0] at Mongoose.connect (/Users/shadan/Desktop/jewlss/backend/pishkesh/node_modules/mongoose/lib/index.js:332:15)
[0] at Object.<anonymous> (/Users/shadan/Desktop/jewlss/backend/pishkesh/server.js:19:4)
[0] at Module._compile (internal/modules/cjs/loader.js:959:30)
[0] at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
[0] at Module.load (internal/modules/cjs/loader.js:815:32)
[0] at Function.Module._load (internal/modules/cjs/loader.js:727:14)
[0] at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10)
[0] at internal/main/run_main_module.js:17:11 {
[0] message: 'Server selection timed out after 30000 ms',
[0] name: 'MongooseTimeoutError',
[0] reason: MongoNetworkError: connection 67 to cluster0-shard-00-01-w7aav.mongodb.net:27017 closed
[0] at TLSSocket.<anonymous>
[0] at Object.onceWrapper (events.js:300:26)
[0] at TLSSocket.emit (events.js:210:5)
[0] at net.js:659:12
[0] at TCP.done (_tls_wrap.js:481:7) {
[0] name: 'MongoNetworkError',
[0] [Symbol(mongoErrorContextSymbol)]: {}
[0] },
[0] [Symbol(mongoErrorContextSymbol)]: {}
[0] }