通过 nodemon 重新启动时从 mongodb atlas 正常断开连接

Gracefully disconnecting to from mongodb atlas upon restarting via nodemon

当前应用程序处于开发阶段,nodejs 服务器将重新启动所有文件更改。这让 mongoose 重新连接到 MongoDB 服务器。

我是唯一一个连接删除 MongoDB 图集的用户,我不知道它显示的 5 个连接是如何打开的。我不知道。

有什么方法可以在重新启动应用程序之前断开与 MongoDB 服务器的连接

I am the only one user to connect to remove MongoDB atlas by I don't know how its showing 5 connections are already opened.

MongoDB 使用内部连接用于各种目的,例如副本集节点通信。

Is there any way to disconnect from MongoDB server before restarting of the application

肯定有,但如果您担心 Atlas 会打开额外的连接,在这种规模(5 个连接)下,确实不值得担心。