Skip to content

Commit a37808b

Browse files
jason-price-mongodbjason-price-mongodb
andauthored
DOCSP-32941-resharding-update (#5254) (#5291)
* DOCSP-32941-resharding-update * DOCSP-32941-resharding-update --------- Co-authored-by: jason-price-mongodb <[email protected]>
1 parent 843beff commit a37808b

File tree

2 files changed

+18
-30
lines changed

2 files changed

+18
-30
lines changed

source/core/sharding-reshard-a-collection.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ across a cluster.
3030
.. _reshard-requirements:
3131

3232
Requirements
33-
--------------
33+
------------
3434

3535
Before you reshard your collection, ensure that you meet the following
3636
requirements:
@@ -105,6 +105,7 @@ requirements:
105105
check for any running index builds:
106106

107107
.. code-block:: javascript
108+
:copyable: false
108109

109110
db.adminCommand(
110111
{
@@ -120,6 +121,7 @@ requirements:
120121
array, there are no index builds in progress:
121122

122123
.. code-block:: javascript
124+
:copyable: false
123125

124126
{
125127
inprog: [],

source/reference/method/sh.reshardCollection.txt

Lines changed: 15 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -20,32 +20,30 @@ Definition
2020
The :method:`sh.reshardCollection()` method changes the shard key for
2121
a collection and changes the distribution of your data.
2222

23+
Before you reshard a collection, read the the :ref:`reshard
24+
requirements <reshard-requirements>` and :ref:`reshard limitations
25+
<resharding-limitations>`.
26+
2327
.. |dbcommand| replace:: :dbcommand:`reshardCollection` command
2428
.. include:: /includes/fact-mongosh-shell-method-alt.rst
2529

26-
:method:`sh.reshardCollection()` takes the following arguments:
30+
``sh.reshardCollection()`` takes the following fields:
2731

2832
.. list-table::
2933
:header-rows: 1
3034
:widths: 20 20 80
3135

32-
* - Parameter
33-
36+
* - Field
3437
- Type
35-
3638
- Description
3739

3840
* - ``namespace``
39-
4041
- string
41-
4242
- The :term:`namespace` of the collection to shard in the form
4343
``"<database>.<collection>"``.
4444

4545
* - ``key``
46-
4746
- document
48-
4947
- The document that specifies the new field or fields to use as the
5048
:doc:`shard key </core/sharding-shard-key/>`.
5149

@@ -54,44 +52,34 @@ Definition
5452
Set the field values to either:
5553

5654
- ``1`` for :doc:`ranged based sharding </core/ranged-sharding>`
57-
5855
- ``"hashed"`` to specify a
5956
:ref:`hashed shard key <hashed-shard-keys>`.
6057

6158
See also :ref:`sharding-shard-key-indexes`
6259

6360
* - ``unique``
64-
6561
- boolean
66-
6762
- Optional. Specify whether there is a :doc:`uniqueness
6863
</core/index-unique>` constraint on the shard key. Only
6964
``false`` is supported. Defaults to ``false``.
7065

7166
* - ``options``
72-
7367
- document
74-
7568
- Optional. A document containing optional fields, including
7669
``numInitialChunks``, ``collation`` and ``zones``.
7770

78-
79-
The ``options`` argument supports the following options:
71+
The ``options`` field supports the following fields:
8072

8173
.. list-table::
8274
:header-rows: 1
8375
:widths: 20 20 80
8476

85-
* - Parameter
86-
77+
* - Field
8778
- Type
88-
8979
- Description
9080

9181
* - ``numInitialChunks``
92-
9382
- integer
94-
9583
- Optional. Specifies the initial number of chunks to create
9684
across all shards in the cluster when resharding a collection.
9785
The default is the number of chunks that exist for the
@@ -100,23 +88,20 @@ The ``options`` argument supports the following options:
10088
``numInitialChunks`` must result in less than ``8192`` per shard.
10189

10290
* - ``collation``
103-
10491
- document
105-
10692
- Optional. If the collection specified to ``reshardCollection``
10793
has a default :doc:`collation </reference/collation>`,
10894
you *must* include a collation document with
10995
``{ locale : "simple" }``, or the ``reshardCollection``
11096
command fails.
11197

11298
* - ``zones``
113-
11499
- array
115-
116100
- Optional. To maintain or add :ref:`zones <zone-sharding>`,
117101
specify the zones for your collection in an array:
118102

119103
.. code-block:: javascript
104+
:copyable: false
120105

121106
[
122107
{
@@ -169,7 +154,7 @@ During the clone, apply, and catch-up phase:
169154

170155
.. note::
171156

172-
If desired, you can manually force the resharding operation to
157+
If required, you can manually force the resharding operation to
173158
complete by issuing the :method:`sh.commitReshardCollection()`
174159
method. This is useful if the current time estimate to complete the
175160
resharding operation is an acceptable duration for your collection
@@ -183,8 +168,8 @@ During the clone, apply, and catch-up phase:
183168
Commit Phase
184169
~~~~~~~~~~~~
185170

186-
- Once the resharding process reaches the commit phase, it may no longer
187-
be aborted with :method:`sh.abortReshardCollection()`.
171+
- After the resharding process reaches the commit phase, the process
172+
cannot be ended with :method:`sh.abortReshardCollection()`.
188173
- When all shards have reached strict consistency, the resharding
189174
coordinator commits the resharding operation and installs the new
190175
routing table.
@@ -208,11 +193,12 @@ new shard key ``{ order_id: 1 }``:
208193

209194
.. code-block:: javascript
210195

211-
sh.reshardCollection("sales.orders", { order_id: 1 })
196+
sh.reshardCollection( "sales.orders", { order_id: 1 } )
212197

213-
MongoDB returns the following:
198+
Example output:
214199

215200
.. code-block:: javascript
201+
:copyable: false
216202

217203
{
218204
ok: 1,

0 commit comments

Comments
 (0)