@@ -91,6 +91,38 @@ Request Body Parameters
91
91
- Required
92
92
- Name of the destination cluster.
93
93
94
+ * - ``buildIndexes``
95
+ - boolean
96
+ - Optional
97
+ - Configures index builds during sync.
98
+
99
+ Supported Options:
100
+
101
+ - ``beforeDataCopy`` (the default) causes ``mongosync`` to build indexes
102
+ on the destination cluster. These include both existing indexes and
103
+ any indexes created during migration on the source cluster.
104
+
105
+ - ``never`` causes ``mongosync`` to skip building unnecessary indexes
106
+ during sync. This can improve migration performance, especially with
107
+ index heavy workloads.
108
+
109
+ .. warning::
110
+
111
+ Do **not** manually build indexes while ``mongosync`` is
112
+ performing a migration. Wait until the migration is fully
113
+ committed.
114
+
115
+ For more information on the indexes it does build, see
116
+ :ref:`c2c-required-indexes`.
117
+
118
+ ``/start`` returns an error when ``buildIndexes`` is set to ``never``
119
+ and ``reversible`` is set to ``true``.
120
+
121
+ If you call ``/start`` without specifying the ``buildIndexes`` option,
122
+ ``mongosync`` builds indexes on the destination cluster.
123
+
124
+ .. versionadded:: 1.3.0
125
+
94
126
* - ``enableUserWriteBlocking``
95
127
- boolean
96
128
- Optional
@@ -136,6 +168,8 @@ Request Body Parameters
136
168
* Sync from a replica set to a sharded cluster
137
169
138
170
* Sync sharded clusters that have different numbers of shards
171
+
172
+ * Reversible sync when ``buildIndexes`` is set to ``never``.
139
173
140
174
For more information, see the :ref:`reverse <c2c-api-reverse>` endpoint.
141
175
@@ -144,7 +178,7 @@ Request Body Parameters
144
178
* - ``sharding``
145
179
- document
146
180
- Optional
147
- - Configure sync between a replica set and sharded cluster.
181
+ - Configures sync between a replica set and sharded cluster.
148
182
Sync from a replica set to a sharded cluster requires this
149
183
option.
150
184
@@ -406,4 +440,22 @@ To check whether it is safe to rename collections, call the
406
440
Renaming the collection from this point on does not block
407
441
its sharding on the destination cluster, even in the event of a crash.
408
442
443
+ .. _c2c-required-indexes:
444
+
445
+ Required Indexes
446
+ ~~~~~~~~~~~~~~~~
447
+
448
+ When you call ``/start`` with the ``buildIndexes`` option set to ``never``,
449
+ ``mongosync`` skips building unnecessary indexes.
450
+
451
+ Indexes that are always built include:
452
+
453
+ * ``mongosync`` builds an index on the ``_id`` field of every
454
+ collection it copies.
455
+
456
+ * Starting in MongoDB 6.0, ``mongosync`` builds dummy indexes that support
457
+ the shard key for each sharded collection, which are removed after commit.
458
+ When ``buildIndexes`` is set to ``never``, ``mongosync`` retains this
459
+ index after commit.
409
460
461
+
0 commit comments