Error! MongoNetworkError: failed to connect to server - after connect to another wifi network

Error! MongoNetworkError: failed to connect to server - after connect to another wifi network

我在 Node.js 和 Mongodb(平均堆栈)中创建了一个带有后端的完整的、可工作的应用程序。一切都很好,但是当我连接到另一个 wifi 网络时出现错误。请帮我。 如果我必须从应用程序发送更多代码,请编写它。

Error! MongoNetworkError: failed to connect to server [eventsdb-shard-00-00-ydx5k.mongodb.net:27017] on first connect [MongoNetworkError: connection 5 to eventsdb-shard-00-00-ydx5k.mongodb.net:27017 closed
    at TLSSocket.<anonymous> 
    at Object.onceWrapper (events.js:300:26)
    at TLSSocket.emit (events.js:210:5)
    at net.js:659:12
    at TCP.done (_tls_wrap.js:481:7) {
  name: 'MongoNetworkError',
  [Symbol(mongoErrorContextSymbol)]: {}
}]

...\App\server\node_modules\mongodb\lib\core\connection\connection.js:372:9 :

function closeHandler(conn) {
  return function(hadError) {
    if (connectionAccounting) deleteConnection(conn.id);

    if (conn.logger.isDebug()) {
      conn.logger.debug(`connection ${conn.id} with for [${conn.address}] closed`);
    }

    if (!hadError) {
      conn.emit(
        'close',
        new MongoNetworkError(`connection ${conn.id} to ${conn.address} closed`), // <------ 372
        conn
      );
    }
  };
}

我解决了我的问题。在我有数据库的Mongodb网站上,我输入"Network Access" -> "Add IP Address",我添加了我的新IP地址,没有错误。