DB connection using mongo.Connect are by default 3 in aws monitoring active connection. Is there a way to set this to 1 initially using mongodb-driver for golang or any language?
DB connection using mongo.Connect are by default 3 in aws. Is there a way to set this to 1 initially?
@George_Taylor welcome and thanks for the question! As you observed, MongoDB drivers open a minimum of 3 connections to each node in a MongoDB deployment. Those connections are used for different purposes:
- Application connection(s) - used for running user-initiated operations (e.g.
Update, etc). The number of application connections is limited to the value configured by maxPoolSize or SetMaxPoolSize (default is 100).
- Monitoring connection - used to communicate database node state changes, such as “shutting down” or “new primary elected”.
- Round-trip timing connection - used to measure the round-trip time to the database node.
MongoDB drivers rely on those connections to behave correctly, so unfortunately there is no way to disable them.