Currently working with Mongodb using the node.js (Native MongoDB) driver, I know it is possible to set the pooled connection count but regardless the same behaviour is observed.
The code in question:
(function init(){
db.connect("mongodb://localhost/test",function(err, database){
});
})();
This is the log from the server:
Thu Dec 06 20:19:32 [initandlisten] connection accepted from 127.0.0.1:58663 #6
(1 connection now open)
Thu Dec 06 20:19:32 [initandlisten] connection accepted from 127.0.0.1:58664 #7
(2 connections now open)
Thu Dec 06 20:19:32 [initandlisten] connection accepted from 127.0.0.1:58665 #8
(3 connections now open)
Thu Dec 06 20:19:32 [initandlisten] connection accepted from 127.0.0.1:58666 #9
(4 connections now open)
Thu Dec 06 20:19:32 [initandlisten] connection accepted from 127.0.0.1:58667 #10
(5 connections now open)
Thu Dec 06 20:19:36 [conn9] end connection 127.0.0.1:58666 (4 connections now op
en)
Thu Dec 06 20:19:36 [conn10] end connection 127.0.0.1:58667 (4 connections now o
pen)
Thu Dec 06 20:19:36 [conn8] end connection 127.0.0.1:58665 (4 connections now op
en)
Thu Dec 06 20:19:36 [conn6] end connection 127.0.0.1:58663 (4 connections now op
en)
Thu Dec 06 20:19:36 [conn7] end connection 127.0.0.1:58664 (4 connections now op
en)
The connections are apparently closing yet the current open connections count doesn't decrement even though the connections are correctly incrementing. Intended behaviour?
PS. Please don't answer with use a nodejs wrapper for mongodb.
database.close();call in the callback the connection count goes back down to 0.