Skip to content

Commit 7f8cadd

Browse files
author
Dave Cuthbert
authored
DOCSP-24963 BACKPORT (#1769)
1 parent 652ede2 commit 7f8cadd

File tree

3 files changed

+30
-19
lines changed

3 files changed

+30
-19
lines changed

source/core/sharding-find-shard-key.txt

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,18 @@ Find a Shard Key
1212
:depth: 2
1313
:class: singlecol
1414

15-
To find the shard key of an existing sharded collection, use the
16-
:method:`db.printShardingStatus()` method:
15+
Every shared collection has a :ref:`shard key <sharding-shard-key>`. To
16+
display the shard key, connect to a :binary:`mongos` instance and run
17+
the :method:`db.printShardingStatus()` method:
1718

1819
.. code-block:: javascript
1920

2021
db.printShardingStatus()
2122

22-
For details on the :method:`db.printShardingStatus()` output, see
23-
:method:`sh.status()`.
23+
The output resembles:
24+
25+
.. include:: /includes/reference/sharded-status-output.rst
26+
27+
For more details on the ``db.printShardingStatus()`` output, see the
28+
:ref:`sharded collection section <sharded-collection-output-reference>`
29+
on the :method:`sh.status()` page.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
.. code-block:: javascript
3+
4+
<dbname>.<collection>
5+
shard key: { <shard key> : <1 or hashed> }
6+
unique: <boolean>
7+
balancing: <boolean>
8+
chunks:
9+
<shard name1> <number of chunks>
10+
<shard name2> <number of chunks>
11+
...
12+
{ <shard key>: <min range1> } -->> { <shard key> : <max range1> } on : <shard name> <last modified timestamp>
13+
{ <shard key>: <min range2> } -->> { <shard key> : <max range2> } on : <shard name> <last modified timestamp>
14+
...
15+
tag: <tag1> { <shard key> : <min range1> } -->> { <shard key> : <max range1> }
16+
...
17+

source/reference/method/sh.status.txt

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -151,28 +151,16 @@ shard` for the database.
151151
{ "_id" : <dbname2>, "primary" : <string>, "partitioned" : <boolean>, "version": <document> }
152152
...
153153

154+
.. _sharded-collection-output-reference:
155+
154156
The :ref:`sharding-status-collection-fields` section provides
155157
information on the sharding details for sharded collection(s). For each
156158
sharded collection, the section displays the shard key, the number of
157159
chunks per shard(s), the distribution of chunks across shards
158160
[#chunk-details]_, and the tag information, if any, for shard key
159161
range(s).
160162

161-
.. code-block:: javascript
162-
163-
<dbname>.<collection>
164-
shard key: { <shard key> : <1 or hashed> }
165-
unique: <boolean>
166-
balancing: <boolean>
167-
chunks:
168-
<shard name1> <number of chunks>
169-
<shard name2> <number of chunks>
170-
...
171-
{ <shard key>: <min range1> } -->> { <shard key> : <max range1> } on : <shard name> <last modified timestamp>
172-
{ <shard key>: <min range2> } -->> { <shard key> : <max range2> } on : <shard name> <last modified timestamp>
173-
...
174-
tag: <tag1> { <shard key> : <min range1> } -->> { <shard key> : <max range1> }
175-
...
163+
.. include:: /includes/reference/sharded-status-output.rst
176164

177165
Output Fields
178166
-------------

0 commit comments

Comments
 (0)