@@ -2774,6 +2774,39 @@ shardingStatistics
27742774 .. code-block:: javascript
27752775
27762776 "shardingStatistics" : {
2777+ "numHostsTargeted": {
2778+ "find" : {
2779+ "allShards": NumberLong(<num>),
2780+ "manyShards": NumberLong(<num>),
2781+ "oneShard": NumberLong(<num>),
2782+ "unsharded": NumberLong(<num>)
2783+ },
2784+ "insert": {
2785+ "allShards": NumberLong(<num>),
2786+ "manyShards": NumberLong(<num>),
2787+ "oneShard": NumberLong(<num>),
2788+ "unsharded": NumberLong(<num>)
2789+ },
2790+ "update": {
2791+ "allShards": NumberLong(<num>),
2792+ "manyShards": NumberLong(<num>),
2793+ "oneShard": NumberLong(<num>),
2794+ "unsharded": NumberLong(<num>)
2795+ },
2796+ "delete": {
2797+ "allShards": NumberLong(<num>),
2798+ "manyShards": NumberLong(<num>),
2799+ "oneShard": NumberLong(<num>),
2800+ "unsharded": NumberLong(<num>)
2801+ },
2802+ "aggregate": {
2803+ "allShards": NumberLong(<num>),
2804+ "manyShards": NumberLong(<num>),
2805+ "oneShard": NumberLong(<num>),
2806+ "unsharded": NumberLong(<num>)
2807+ }
2808+ }
2809+ },
27772810 "catalogCache" : {
27782811 "numDatabaseEntries" : NumberLong(<num>),
27792812 "numCollectionEntries" : NumberLong(<num>),
@@ -3364,6 +3397,28 @@ shardingStatistics
33643397
33653398 .. versionadded:: 5.0
33663399
3400+ .. serverstatus:: shardingStatistics.numHostsTargeted
3401+
3402+ Indicates the number of shards targeted for ``CRUD`` operations and
3403+ aggregation commands. When a ``CRUD`` operation or aggregation
3404+ command is run, the following metrics will be incremented.
3405+
3406+ .. include:: /includes/fact-server-status-num-hosts-targeted.rst
3407+
3408+ .. note:: Running the :dbcommand:`serverStatus` on :binary:`mongos`
3409+ will provide insight into the aggregation operations find,
3410+ insert, update, delete and aggregate that run on a sharded
3411+ cluster.
3412+
3413+ Multi-shard operations can either be
3414+ :ref:`scatter-gather<sharding-query-patterns>`
3415+ or shard specific. Multi-shard scatter-gather operations can
3416+ :ref:`consume more resources<sharding-troubleshooting-scatter-gather>`,
3417+ by using the
3418+ :serverstatus:`shardingStatistics.numHostsTargeted`
3419+ metrics you can tune the aggregation queries that run on a
3420+ sharded cluster.
3421+
33673422.. serverstatus:: shardingStatistics.resharding.coordinatorState
33683423
33693424 State of the resharding coordinator for the current :ref:`resharding
0 commit comments