Skip to content

Commit 7a472dc

Browse files
kennethdyerjordan-smith721mdb-ashleyjmd-mongoDave Cuthbert
authored
DOCSP-25509 $shardedDataDistribution (#2150) (#2210)
* DOCSP-25509 Stubs aggregation stage reference * DOCSP-25509 Fix build * DOCSP-25509 Aggregation stage reference * DOCSP-25509 Adds sidebar to Agg Pipeline page * DOCSP-25509 Adds privilege * DOCSP-25509 Adds privilege note to agg stage reference * Adds release note * Typo * Fixes build issue * Fixes per Joe * Fixes per Joe * DOCSP-26245 update mongocrypt version (#2139) * updated mongocrypt version * revert autoformatting * Update pull_request_template.md * DOCSP-25224 EOL Version Cleanup of mongosh Methods (#1901) * DOCSP-25224 version cleanup in Method Reference * DOCSP-25224 version cleanup in Method Reference * DOCSP-25224 version cleanup in Method Reference * DOCSP-25224 version cleanup in Method Reference * DOCSP-25224 version cleanup in Method Reference * DOCSP-25224 version cleanup in Method Reference * DOCSP-25224 version cleanup in Method Reference * DOCSP-25224 version cleanup in Method Reference * DOCSP-25224 version cleanup in Method Reference * DOCSP-25224 version cleanup in Method Reference * DOCSP-25224 version cleanup in Method Reference * DOCSP-25224 version cleanup in Method Reference * DOCSP-25224 version cleanup in Method Reference * DOCSP-25224 version cleanup in Method Reference * DOCSP-25224 version cleanup in Method Reference * DOCSP-25224 version cleanup in Method Reference * DOCSP-25224 version cleanup in Method Reference * DOCSP-25224 redirects * DOCSP-25224 Updates redirects, removes copyDatabase and cloneDatabase as deprecated * DOCSP-25224 Update for build * DOCSP-25224 Update for build * DOCSP-25224 Fixes build errors * DOCSP-25224 Fixes per Jocelyn * DOCSP-25224 Fixes per Jocelyn * DOCSP-25224 Fixes per Jocelyn * DOCSP-25224 Fixes per Jocelyn * DOCSP-25224 Fixes per Jocelyn * DOCS-15377 Fixes per Jocelyn * DOCSP-25890 adds page-level refs to pages under tutorial/ that have doc directives pointing to them (#2063) * DOCS-15521 sh.status.partitioned not valid (#2050) * DOCS-15521 sh.status.partitioned not valid * DOCS-15521 sh.status.partitioned not valid * DOCS-15521 sh.status.partitioned not valid * Review Feedback * Review feedback * DOCSP-25339 (#2026) * add api docs for rewrapmanydatakeys methods * move to shared include * broken links * update product names, add as constants * (DOCSP-24983) QE Server Side Schema Behavior (#2018) * wip * Trigger Build * proofread, spell-check, grammar-check * js - suggestion Co-authored-by: Jordan Smith <[email protected]> Co-authored-by: Jordan Smith <[email protected]> * (DOCSP-24820) libmongocrypt install fix (#2071) * libmongocryptdev * update qe libmongocrypt page * proofread * (DOCS-15399): 6.1 retryable writes errors (#2066) * (DOCS-15399): 6.1 retryable writes errors * wording * wording and minimalism * fix include name * edits * add clarity * reorder phrases * minimalism * minimalism, formatting * review edits * updates per review * wording * final review edits * minimalism * DOCS-15473 Update exit codes reference (#2070) * DOCSP-26150 Replace :doc: with :method: / :command: where possible (#2074) * Date() * internal review feedback * internal review feedback * internal review * DOCS-15411 commit quorum v write concern (#2009) * DOCS-15411 commitQuorum-and-writeConcerns * DOCS-15411 commitQuorum-and-writeConcerns * Staging fixes * Staging fixes * Review feedback * Staging fixes * Review Feedback * Review Feedback * Review feedback * Review feedback * Staging fixes * Review feedback * Review feedback * Commit feedback * DOCSP-25986 improve style of limitations page (#2047) * DOCSP-25986 timeseries limitations restyling * DOCSP-25986 timeseries limitations restyling * Review Feedback * Staging fixes * Merge feedback * (DOCSP-24856) (#2083) * update qe tut * update qe tuts * update csfle tuts * remove output from tuts that do not produce this output * remove output from code block that does not produce output * add deleted back in * DOCSP-26183 replaces :doc: with improved admonitions (#2080) * DOCSP-26204 update instances of :doc: pointing to core/index-text with :ref: (#2087) * DOCSP-26204 update instances of :doc: pointing to core/index-text with :ref: * internal review feedback * DOCSP-15109 Resume Token Expansion (#2049) * DOCSP-15109 Updates _id token * DOCSP-15109 Updates token sources * DOCSP-15109 Updates token sources * DOCSP-15109 Refactors resume token text * DOCSP-15109 Refactors resume token text * DOCSP-15109 Fixes code block * DOCSP-15109 Fixes code block * DOCSP-15109 Fixes per Dave * DOCSP-15109 Fixes per Dave * DOCSP-15109 Fixes per Dave * DOCSP-15109 Fixes per Dave * DOCSP-15109 Fixes build error * DOCSP-15109 Fixes build error * DOCSP-15109 Fixes build error * DOCSP-15109 Fixes per Valentin * (DOCS-15063): Change to balancerCollectionStatus output (#2085) * (DOCS-15063): Update balancerCollectionStatus command page * more updates * edits * small edits * tweak * wording * add details per tech review * formatting - note * DOCSP-26224 replace docs directives pointing to transactions (#2090) * DOCSP-26224 replace docs directives pointing to transactions * internal review feedback * DOCSP-26193 replaces 2d and 2dsphere index doc admonitions (#2082) * DOCSP-26193 replaces 2d and 2dsphere index doc admonitions * internal review feedback * DOCSP-26256 replaces views-related doc directives (#2092) * DOCSP-26275 replaces write-related doc directives (#2094) * DOCS-15437-reap-transactions (#2062) * DOCS-15437-reap-transactions * DOCS-15437-reap-transactions * DOCS-15437-reap-transactions * DOCS-15437-reap-transactions * DOCS-15437-reap-transactions * DOCS-15437-reap-transactions * DOCS-15437-reap-transactions * DOCS-15437-reap-transactions * DOCS-15437-reap-transactions * DOCS-15437-reap-transactions * DOCS-15437-reap-transactions Co-authored-by: jason-price-mongodb <[email protected]> * DOCSP-26288 replaces auditing-related doc directives (#2102) * DOCSP-26288 replaces auditing-realted doc directives * internal review feedback * internal review feedback * (DOCSP-26124): Add new fill example (#2106) * (DOCSP-26124): Add new fill example * wording * wording * add clarification for values of zero * add note title * tweaks * internal review edits * fix output order * fix toc heading * wording * (DOCSP-22423): Clarify startup instructions for redactClientLogData (#2101) * Clarify startup instructions for redactClientLogData * copy review feedback * final fixes * DOCPS-26298 updates BSON-related doc directives (#2105) * DOCPS-26298 updates BSON-related doc directives * internal review feedback * internal review feedback * update python qe apps from testing with solutions architect (#1887) * DOCSP-26321 updates collation-related doc directives (#2112) * (DOCSP-26328): Migrate changelog script from Python 2 to Python 3 (#2116) * (DOCSP-26328): Migrate changelog script from Python 2 to Python 3 (#2113) * update Makefile command and requirements filename (#2114) * (DOCS-15722): 4.4.18 initial changelog and changelog script fixes (#2117) * (DOCS-15722): 4.4.18 initial changelog * fix bug with changelog output * refactoring * regenerate 4.4.18 changelog * fix typo * DOCSP-26358 replaces agg pipline doc directives (#2120) * DOCS-15516 Time series range outside 1970-2038 behavior (#2119) * Add a missing named reference definition in 5.1-compatibility (#2115) * DOCSP-25224 version cleanup in Method Reference Co-authored-by: jmd-mongo <[email protected]> Co-authored-by: Dave Cuthbert <[email protected]> Co-authored-by: Aleksander Binion <[email protected]> Co-authored-by: Jordan Smith <[email protected]> Co-authored-by: Jeff Allen <[email protected]> Co-authored-by: Nick Villahermosa <[email protected]> Co-authored-by: jason-price-mongodb <[email protected]> Co-authored-by: jason-price-mongodb <[email protected]> Co-authored-by: davidhou17 <[email protected]> Co-authored-by: Heli Aldridge <[email protected]> * (DOCS-13987): Introduce updated query planner diagram (#2107) * Add new query planner diagram * tech review feedback * tech review feedback 2 * final changes * DOCSP-26426 Replaces Compound-GeoJSON doc directives (#2156) * (DOCS-15740): Finalize 6.0.3 changelog (#2158) * (DOCS-15740): Finalize 6.0.3 changelog * remove extra space * (DOCS-15741): Finalize 4.4.18 changelog (#2160) * (DOCSP-26069): Inaccuracy in document count for multi-document transactions (#2138) * Inaccuracy in document count for multi-document transactions * copy review feedback * copy review feedback 2 * copy review feedback 3 * tech review feedback * (DOCS-15746): Add changelog for 5.0.14 (#2163) * (DOCSP-26626): Fix mongod/mongos formatting (#2170) * DOCSP-26428 Replace Getting Started Guide-LDAP Proxy doc directives (#2165) * DOCSP-26428 Replace Getting Started Guide-LDAP Proxy doc directives * internal review feedback * fix release dates in release notes (#2175) * (DOCS-14355): fix regex pattern in validation example (#2166) * (DOCS-14355): fix regex pattern in validation example * change example * typo * fix formatting * remove extra sentence * formatting * consistency * update section titles per review * (DOCS-10564): Sharding tutorial - distribute collections using zones (#2142) * initial page setup * WIP * wip * WIP * finish balancer section * fix widths * add security prereq * (DOCS-16064): Sharding tutorial - distribute collections using zones * edits * fix learn more * add prereq * fix code block highlighting * typo * wording * WIP review edits * finish review edits * edits * edits * typo fixes * updates per Asya's feedback * wording * remove extra heading * review edits * wording * reorder * add clarification * clarify balancing behavior * ordering * wording * alphabetize * edits * (DOCS-11076): Document inaccuracies when inserting documents (#2149) * add information about insert inaccuracies * copy review feedback * tech review feedback * (DOCS-7159): Add tcmalloc verbosity section to serverStatus() (#2167) * Add tcmalloc section to serverStatus() * copy review feedback * Update source/reference/command/serverStatus.txt Co-authored-by: Kyle Suarez <[email protected]> Co-authored-by: Kyle Suarez <[email protected]> * DOCS-11817: clarify single-version downgrade (#2188) * clarify single-version downgrade * fix include replacements * update 6.0 downgrade pages * update 5.0 downgrade instructions * fix build warnings * update 4.4 downgrade pages * update language and use replacements * language * use correct include for standalone pages * grammar * remove extra include file * updates per review * formatting * DOCSP-26654: Bolding edits (#2192) * Fixes per Jordi Co-authored-by: Jordan Smith <[email protected]> Co-authored-by: Ashley Brown <[email protected]> Co-authored-by: jmd-mongo <[email protected]> Co-authored-by: Dave Cuthbert <[email protected]> Co-authored-by: Aleksander Binion <[email protected]> Co-authored-by: Jeff Allen <[email protected]> Co-authored-by: Nick Villahermosa <[email protected]> Co-authored-by: jason-price-mongodb <[email protected]> Co-authored-by: jason-price-mongodb <[email protected]> Co-authored-by: davidhou17 <[email protected]> Co-authored-by: Heli Aldridge <[email protected]> Co-authored-by: Kyle Suarez <[email protected]> Co-authored-by: Sarah Olson <[email protected]> Co-authored-by: Jordan Smith <[email protected]> Co-authored-by: Ashley Brown <[email protected]> Co-authored-by: jmd-mongo <[email protected]> Co-authored-by: Dave Cuthbert <[email protected]> Co-authored-by: Aleksander Binion <[email protected]> Co-authored-by: Jeff Allen <[email protected]> Co-authored-by: Nick Villahermosa <[email protected]> Co-authored-by: jason-price-mongodb <[email protected]> Co-authored-by: jason-price-mongodb <[email protected]> Co-authored-by: davidhou17 <[email protected]> Co-authored-by: Heli Aldridge <[email protected]> Co-authored-by: Kyle Suarez <[email protected]> Co-authored-by: Sarah Olson <[email protected]>
1 parent 6040be6 commit 7a472dc

File tree

4 files changed

+144
-0
lines changed

4 files changed

+144
-0
lines changed

source/reference/operator/aggregation-pipeline.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ Aggregation Pipeline Stages
66

77
.. default-domain:: mongodb
88

9+
.. contents:: On this page
10+
:local:
11+
:backlinks: none
12+
:depth: 1
13+
:class: singlecol
14+
915
In the :method:`db.collection.aggregate` method and
1016
:method:`db.aggregate` method, :doc:`pipeline
1117
</core/aggregation-pipeline>` stages appear in an array. Documents pass
@@ -306,6 +312,12 @@ Alphabetical Listing of Stages
306312

307313
.. versionadded:: 5.0
308314

315+
* - :pipeline:`$shardedDataDistribution`
316+
317+
- Provides data and size distribution information on sharded collections.
318+
319+
.. versionadded:: 6.0.3
320+
309321

310322
* - :pipeline:`$skip`
311323

@@ -386,6 +398,7 @@ Alphabetical Listing of Stages
386398
/reference/operator/aggregation/searchMeta
387399
/reference/operator/aggregation/set
388400
/reference/operator/aggregation/setWindowFields
401+
/reference/operator/aggregation/shardedDataDistribution
389402
/reference/operator/aggregation/skip
390403
/reference/operator/aggregation/sort
391404
/reference/operator/aggregation/sortByCount
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
======================================
2+
$shardedDataDistribution (aggregation)
3+
======================================
4+
5+
.. default-domain:: mongodb
6+
7+
.. contents:: On this page
8+
:local:
9+
:backlinks: none
10+
:depth: 2
11+
:class: singlecol
12+
13+
Definition
14+
----------
15+
16+
.. pipeline:: $shardedDataDistribution
17+
18+
.. versionadded:: 6.0.3
19+
20+
Returns information on the distribution of data in sharded collections.
21+
22+
.. note::
23+
24+
This aggregation stage is only available on :program:`mongos`.
25+
26+
This aggregation stage must be run on the ``admin`` database. The user must
27+
have the :authaction:`shardedDataDistribution` privilege action.
28+
29+
Syntax
30+
------
31+
32+
The ``shardedDataDistribution`` stage has the following syntax:
33+
34+
.. code-block:: javascript
35+
36+
db.aggregate( [
37+
{ $shardedDataDistribution: { } }
38+
] )
39+
40+
41+
42+
Output Fields
43+
-------------
44+
45+
The ``$shardedDataDistribution`` stage outputs an array of documents
46+
for each sharded collection in the database. These documents contain the
47+
following fields:
48+
49+
.. list-table::
50+
:header-rows: 1
51+
:widths: 30 15 55
52+
53+
* - Field Name
54+
- Data Type
55+
- Description
56+
57+
* - ``ns``
58+
- string
59+
- The namespace of the sharded collection.
60+
61+
* - ``shards``
62+
- array
63+
- Lists the shards in the collection with data distribution information
64+
on each shard.
65+
66+
* - ``shards.numOrphanedDocs``
67+
- integer
68+
- Number of orphaned documents in the shard.
69+
70+
* - ``shards.numOwnedDocuments``
71+
- integer
72+
- Number of documents owned by the shard.
73+
74+
* - ``shards.orphanedSizeBytes``
75+
- integer
76+
- Amount of storage in bytes used by orphaned documents in the shard.
77+
78+
* - ``shards.ownedSizeBytes``
79+
- integer
80+
- Amount of storage in bytes used by owned documents in the shard.
81+
82+
83+
Examples
84+
--------
85+
86+
.. code-block:: javascript
87+
88+
db.aggregate( [
89+
{ $shardedDataDistribution: { } }
90+
] )
91+
92+
Example output:
93+
94+
.. code-block:: json
95+
96+
[
97+
{
98+
"ns": "test.names",
99+
"shards": [
100+
{
101+
"shardName": "shard-1",
102+
"numOrphanedDocs": 0,
103+
"numOwnedDocuments": 6,
104+
"ownedSizeBytes": 366,
105+
"orphanedSizeBytes": 0
106+
},
107+
{
108+
"shardName": "shard-2",
109+
"numOrphanedDocs": 0,
110+
"numOwnedDocuments": 6,
111+
"ownedSizeBytes": 366,
112+
"orphanedSizeBytes": 0
113+
}
114+
]
115+
}
116+
]
117+

source/reference/privilege-actions.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,13 @@ Sharding Actions
552552
User can perform the :dbcommand:`removeShard` command. Apply this
553553
action to the ``cluster`` resource.
554554

555+
.. authaction:: shardedDataDistribution
556+
557+
User can perform the :pipeline:`$shardedDataDistribution` aggregation
558+
pipeline stage.
559+
560+
.. versionadded:: 6.0.3
561+
555562
.. authaction:: shardingState
556563

557564
User can perform the :dbcommand:`shardingState` command. Apply this

source/release-notes/6.0.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,13 @@ MongoDB 6.0 introduces the following aggregation stages:
137137
* - :pipeline:`$fill`
138138
- .. include:: /includes/fact-fill-description.rst
139139

140+
* - :pipeline:`$shardedDataDistribution`
141+
- .. versionadded:: 6.0.3
142+
143+
Provides size and data distribution information on sharded
144+
collections.
145+
146+
140147
.. _6.0-rel-notes-new-agg-operators:
141148

142149
New Aggregation Operators

0 commit comments

Comments
 (0)