@@ -2774,6 +2774,39 @@ shardingStatistics
2774
2774
.. code-block:: javascript
2775
2775
2776
2776
"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
+ },
2777
2810
"catalogCache" : {
2778
2811
"numDatabaseEntries" : NumberLong(<num>),
2779
2812
"numCollectionEntries" : NumberLong(<num>),
@@ -3364,6 +3397,29 @@ shardingStatistics
3364
3397
3365
3398
.. versionadded:: 5.0
3366
3399
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::
3409
+
3410
+ Running the :dbcommand:`serverStatus` command on :binary:`mongos`
3411
+ will provide insight into the CRUD and aggregation operations that
3412
+ run on a sharded cluster.
3413
+
3414
+ Multi-shard operations can either be
3415
+ :ref:`scatter-gather<sharding-query-patterns>`
3416
+ or shard specific. Multi-shard scatter-gather operations can
3417
+ :ref:`consume more resources<sharding-troubleshooting-scatter-gather>`.
3418
+ By using the
3419
+ :serverstatus:`shardingStatistics.numHostsTargeted`
3420
+ metrics you can tune the aggregation queries that run on a
3421
+ sharded cluster.
3422
+
3367
3423
.. serverstatus:: shardingStatistics.resharding.coordinatorState
3368
3424
3369
3425
State of the resharding coordinator for the current :ref:`resharding
0 commit comments