Definition
shardConnPoolStatsRemoved in MongoDB 5.0. Use
connPoolStatsinstead.Returns information on the pooled and cached connections in the sharded connection pool. The command also returns information on the per-thread connection cache in the connection pool.
The
shardConnPoolStatscommand uses the following syntax:{ shardConnPoolStats: 1 } The sharded connection pool is specific to connections between members in a sharded cluster. The
mongosinstances in a cluster use the connection pool to execute client reads and writes. Themongodinstances in a cluster use the pool when issuingmapReduceto query temporary collections on other shards.When the cluster requires a connection, MongoDB pulls a connection from the sharded connection pool into the per-thread connection cache. MongoDB returns the connection to the connection pool after every operation.
Compatibility
This command is available in deployments hosted in the following environments:
MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud
MongoDB Enterprise: The subscription-based, self-managed version of MongoDB
MongoDB Community: The source-available, free-to-use, and self-managed version of MongoDB
Output
shardConnPoolStats.hostsDisplays connection status for each config server, replica set, and standalone instance in the cluster.
shardConnPoolStats.hosts.<host>.availableThe number of connections available for this host to connect to the
mongos.
shardConnPoolStats.hosts.<host>.createdThe number of connections the host has ever created to connect to the
mongos.
shardConnPoolStats.replicaSetsDisplays information specific to replica sets.
shardConnPoolStats.replicaSets.<name>.hostHolds an array of documents that report on each replica set member. These values derive from the replica set status values.
shardConnPoolStats.replicaSets.<name>.host[n].okThis field is for internal use. Reports
falsewhen themongoseither cannot connect to instance or received a connection exception or error.
shardConnPoolStats.replicaSets.<name>.host[n].ismasterThe host is the replica set's primary if this is
true.
shardConnPoolStats.replicaSets.<name>.host[n].hiddenThe host is a hidden member of the replica set if this is
true.
shardConnPoolStats.replicaSets.<name>.host[n].secondaryThe host is a hidden member of the replica set if this is
true.The host is a secondary member of the replica set if this is
true.
shardConnPoolStats.replicaSets.<name>.host[n].pingTimeMillisThe latency, in milliseconds, from the
mongosto this member.
shardConnPoolStats.replicaSets.<name>.host[n].tagsA
tagsdocument contains user-defined tag field and value pairs for the replica set member.{ "<tag1>": "<string1>", "<tag2>": "<string2>",... } For read operations, you can specify a tag set in the read preference to direct the operations to replica set member(s) with the specified tag(s).
For write operations, you can create a customize write concern using
settings.getLastErrorModesandsettings.getLastErrorDefaults.
For more information, see Configure Replica Set Tag Sets.
shardConnPoolStats.totalAvailableThe number of connections available from the
mongosto the config servers, replica sets, and standalonemongodinstances in the cluster.
shardConnPoolStats.totalCreatedThe number of connections the
mongoshas ever created to other members of the cluster.
shardConnPoolStats.threadsDisplays information on the per-thread connection cache.
shardConnPoolStats.threads.hostsDisplays each incoming client connection. For a
mongos, this array field displays one document per incoming client thread. For amongod, the array displays one entry per incoming shardedmapReduceclient thread.shardConnPoolStats.threads.hosts.hostThe host using the connection. The host can be a config server, replica set, or standalone instance.