本文介绍了猫鼬关闭连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个Mongoose Connection,在程序中的某个时候我需要关闭它.多次记录猫鼬对象后,我发现以下方法有效
I have A Mongoose Connection and at some point in my program I need to close it.after logging the mongoose object several times, I have found that the following workd
mongoose.connection.base.connections[1].close();
是否有一种更清洁的方法?
Is There A Cleaner way to do this?
推荐答案
要关闭Mongoose连接池中的所有连接,
To close all connections in the Mongoose connection pool:
mongoose.disconnect();
文档此处.
这篇关于猫鼬关闭连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!