Mahahari
Mahahari

Reputation: 1011

When the mongodb database connection is closed using sails.js?

I am using sails-mongo .

MongoLocal: {

module: 'sails-mongo',
host: 'localhost',
port : '27017',
user: '',
password: '', 
database: 'test'

}

I would like to know when is the sails.js closing the connections for mongodb ?

For eg : Currently , if i have 10models , total connections is about 70-90 connections. How can i make it only one connection per one application instance?

Please help. Thanks a lot.

Upvotes: 3

Views: 485

Answers (1)

Ryan W
Ryan W

Reputation: 6173

I found there's a poolSize in the configuration of sails-mongo here and the sails-mongo is using Mongo native client which has a key maxPoolSize. Haven't tried it but maybe its something you're looking for

{
    module: 'sails-mongo',
    host: 'localhost',
    port : '27017',
    user: '',
    password: '', 
    database: 'test',
    maxPoolSize: 1,
    poolSize: 1
}

Upvotes: 1

Related Questions