首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >VSCode停止连接到MongoDB服务器- NodeJS

VSCode停止连接到MongoDB服务器- NodeJS
EN

Stack Overflow用户
提问于 2020-12-02 17:48:25
回答 1查看 171关注 0票数 0

我有一个NodeJS应用程序,它使用Mongoose在我的MongoDB数据库中存储(少量)数据。在保存项目中的任何文件时,我使用Nodemon自动重新启动服务器。当我第一次打开VSCode终端时,我会在它中输入VSCode,通常直到退出VSCode为止。在我使服务器自动重新启动几次之后,我的应用程序停止连接到MongoDB。这已经发生了,因为我已经开始使用蒙戈,但我仍然没有找到解决办法。这是我遇到的错误,经过一段时间,应用程序试图连接到Mongo数据库:

代码语言:javascript
复制
C:\Users\enric\Desktop\NodeJS Course\Section 14 - Sessions and Cookies\Online Shop Website\node_modules\mongodb\lib\utils.js:671
          throw error;
          ^

Error: Error connecting to db: queryTxt ETIMEOUT nodecoursecluster.lmj6z.mongodb.net
    at C:\Users\enric\Desktop\NodeJS Course\Section 14 - Sessions and Cookies\Online Shop Website\node_modules\connect-mongodb-session\index.js:78:17
    at C:\Users\enric\Desktop\NodeJS Course\Section 14 - Sessions and Cookies\Online Shop Website\node_modules\mongodb\lib\utils.js:668:9       
    at C:\Users\enric\Desktop\NodeJS Course\Section 14 - Sessions and Cookies\Online Shop Website\node_modules\mongodb\lib\mongo_client.js:225:23
    at C:\Users\enric\Desktop\NodeJS Course\Section 14 - Sessions and Cookies\Online Shop Website\node_modules\mongodb\lib\operations\connect.js:284:21
    at QueryReqWrap.callback (C:\Users\enric\Desktop\NodeJS Course\Section 14 - Sessions and Cookies\Online Shop Website\node_modules\mongodb\lib\core\uri_parser.js:90:18)
    at QueryReqWrap.onresolve [as oncomplete] (node:dns:203:10)
[nodemon] app crashed - waiting for file changes before starting...

有什么办法能解决这个问题吗?

(如果有人问起,我一定会提供任何额外的所需信息。)

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-12-04 06:30:08

我能够通过将DNS更改为谷歌的88888844来解决这个问题。我跟踪了的视频。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65113457

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档