node.js - connect-mongo, How can I confirm it re-use my mongoose connection? -




if connect-mongo re-use mongoose connection. how can confirm that?

the config:

const mongostore: connectmongo.mongostore = new mongostore({   mongooseconnection: mongoose.connection }); 

i use db.serverstatus().connections.current check whether or not connect-mongo re-use mongoose connection. think if does, count of connection mongodb should two. (one mongo shell, 1 mongoose of server.)

watch out: since use webpack -w -d , nodemon index.js, not sure whether or not create new connection mongodb when saved(the webpack incremental compilation , nodemon restart server). count of connection testing, start server, not doing saved operation ensure server create initial connection mongodb.

> var status = db.serverstatus() > status.connections { "current" : 1, "available" : 5733, "totalcreated" : 2 }   //current: 1 - mongo shell.  start server. > status.connections { "current" : 1, "available" : 5733, "totalcreated" : 2 }  //it seems new connection not change status.connections reference. > var status = db.serverstatus() // new status reference. > status.connections { "current" : 3, "available" : 5731, "totalcreated" : 4 } // current: 3? thought if connect-mongo re-use mongoose connection. current should 2, not 3. - mongo shell + server mongoose connection = 2 > 

so, there better way confirm connect-mongo re-use mongoose connection exactly?





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -

python - Read npy file directly from S3 StreamingBody -