我正在使用monk模块从mongodb获取数据。但是一旦我连接到db,它就会创建5个连接。
这是我的命令行mongodb服务器控制台......
2015-05-14T10:32:35.618+0530 I NETWORK [initandlisten] connection accepted from
127.0.0.1:61015 #3 (2 connections now open)
2015-05-14T10:32:35.619+0530 I NETWORK [initandlisten] connection accepted from
127.0.0.1:61016 #4 (3 connections now open)
2015-05-14T10:32:35.621+0530 I NETWORK [initandlisten] connection accepted from
127.0.0.1:61017 #5 (4 connections now open)
2015-05-14T10:32:35.621+0530 I NETWORK [initandlisten] connection accepted from
127.0.0.1:61018 #6 (5 connections now open)
2015-05-14T10:32:35.622+0530 I NETWORK [initandlisten] connection accepted from
127.0.0.1:61019 #7 (6 connections now open)
2015-05-14T10:32:35.629+0530 I NETWORK [conn3] end connection 127.0.0.1:61015 (
5 connections now open)
2015-05-14T10:32:35.629+0530 I NETWORK [conn4] end connection 127.0.0.1:61016 (
5 connections now open)
2015-05-14T10:32:35.629+0530 I NETWORK [conn5] end connection 127.0.0.1:61017 (
5 connections now open)
2015-05-14T10:32:35.629+0530 I NETWORK [conn6] end connection 127.0.0.1:61018 (
5 connections now open)
2015-05-14T10:32:35.629+0530 I NETWORK [conn7] end connection 127.0.0.1:61019 (
5 connections now open)
答案 0 :(得分:0)
按如下所示设置monk
连接池的大小:
const monk = require('monk');
const db = monk('localhost/mydb', {
poolSize: 7 // number of connections
});
默认为5
。