Kyle Richardson
Kyle Richardson

Reputation: 5645

Mongoose 4.8.1 poolSize won't go above 2

For some reason I can't seem to get the poolSize of MongoDB connects to go above 2.

Code example:

let database_uri = 'mongodb://localhost:27017/some_database';

let options = {
    server: {
        poolSize: 5
    }
}

mongoose.connect(database_uri, options);

The above code will only produce 2 connections. If I set poolSize to 1 it produces 1 connection. If I set it to 2, it produces 2 connections. Anything above 2 only produces 2 connections. All of the documentation I've read says the default is 5 and that you can set this number to anything you want, 10, 15, 500... So any idea why it won't go above 2 for me?

Upvotes: 0

Views: 109

Answers (1)

Kyle Richardson
Kyle Richardson

Reputation: 5645

I apologize, I should have updated this sooner.

Valeri Karpov : "More recent versions of the mongodb driver grow/shrink the connection pool based on usage so the provided poolSize is now treated as the maximum number of connections rather than the actual number of connections."

Upvotes: 1

Related Questions