@@ -61,6 +61,30 @@ the following changes that mimic the sync finalization process of the
61
61
size. To set your required maximum size, use the
62
62
:dbcommand:`collMod` command.
63
63
64
+ .. _c2c-dr-write-blocking:
65
+
66
+ Write blocking
67
+ --------------
68
+
69
+ When write blocking is enabled as part of the :ref:`/start
70
+ <c2c-api-start>` command, ``mongosync`` blocks user writes on the
71
+ destination cluster during replication. If replication ends
72
+ prematurely, you must manually unblock writing on the destination.
73
+
74
+ After writing is enabled, you can redirect writes from your client
75
+ application to the destination cluster.
76
+
77
+ To enable writes, update :dbcommand:`setUserWriteBlockMode`:
78
+
79
+ .. code-block:: javascript
80
+
81
+ db.adminCommand(
82
+ {
83
+ setUserWriteBlockMode: 1,
84
+ global: false
85
+ }
86
+ )
87
+
64
88
.. _c2c-dr-unique:
65
89
66
90
Unique Indexes
@@ -79,6 +103,19 @@ For each non-unique index on the destination cluster that should be
79
103
unique, run :dbcommand:`collMod` with ``prepareUnique`` set to
80
104
``true``.
81
105
106
+ .. example::
107
+
108
+ .. code-block:: javascript
109
+ :emphasize-lines: 5
110
+
111
+ db.runCommand( {
112
+ collMod: "<collection_name>",
113
+ index: {
114
+ keyPattern: <index_spec> || name: <index_name>,
115
+ prepareUnique: true
116
+ }
117
+ } )
118
+
82
119
After running ``collMod``, the index rejects any new writes that
83
120
would introduce duplicate keys.
84
121
@@ -90,6 +127,19 @@ There may still be uniqueness conflicts in the index after you run
90
127
index, run ``collMod`` with ``unique`` set to ``true`` on each of the
91
128
non-unique indexes that you want to set as unique.
92
129
130
+ .. example::
131
+
132
+ .. code-block:: javascript
133
+ :emphasize-lines: 5
134
+
135
+ db.runCommand( {
136
+ collMod: "<collection_name>",
137
+ index: {
138
+ keyPattern: <index_spec> || name: <index_name>,
139
+ unique: true
140
+ }
141
+ } )
142
+
93
143
If the call to ``collMod`` succeeds, there are no uniqueness violations
94
144
on that index and the index is converted to an unique index.
95
145
@@ -109,6 +159,19 @@ to ``MAX_INT`` for :ref:`TTL indexes
109
159
<index-feature-ttl>`. To reset ``expireAfterSeconds``, use the
110
160
:dbcommand:`collMod` command to change the expiration value.
111
161
162
+ .. example::
163
+
164
+ .. code-block:: javascript
165
+ :emphasize-lines: 5
166
+
167
+ db.runCommand( {
168
+ collMod: "<collection_name>",
169
+ index: {
170
+ keyPattern: <index_spec> || name: <index_name>,
171
+ expireAfterSeconds: <number_of_seconds>
172
+ }
173
+ } )
174
+
112
175
.. _c2c-dr-hidden:
113
176
114
177
Hidden Indexes
@@ -117,29 +180,18 @@ During synchronization, :ref:`hidden indexes <index-type-hidden>` are
117
180
not hidden on the destination cluster. Use the ``collMod`` command to
118
181
hide indexes that should be hidden.
119
182
120
- .. _c2c-dr-write-blocking:
121
-
122
- Write blocking
123
- --------------
124
-
125
- When write blocking is enabled as part of the :ref:`/start
126
- <c2c-api-start>` command, ``mongosync`` blocks user writes on the
127
- destination cluster during replication. If replication ends
128
- prematurely, you must manually unblock writing on the destination.
129
-
130
- After writing is enabled, you can redirect writes from your client
131
- application to the destination cluster.
183
+ .. example::
132
184
133
- To enable writes, update :dbcommand:`setUserWriteBlockMode`:
185
+ .. code-block:: javascript
186
+ :emphasize-lines: 5
134
187
135
- .. code-block:: javascript
136
-
137
- db.adminCommand(
138
- {
139
- setUserWriteBlockMode: 1,
140
- global: false
141
- }
142
- )
188
+ db.runCommand( {
189
+ collMod: "<collection_name>",
190
+ index: {
191
+ keyPattern: <index_spec> || name: <index_name>,
192
+ hidden: true
193
+ }
194
+ } )
143
195
144
196
.. _c2c-dr-capped-collections:
145
197
@@ -149,3 +201,14 @@ Capped Collections
149
201
During synchronization, capped collections are set to the maximum
150
202
allowable size. To set your required maximum size, use the ``collMod``
151
203
command. For details, see :ref:`resize-capped-collection`.
204
+
205
+ .. example::
206
+
207
+ .. code-block:: javascript
208
+ :emphasize-lines: 3
209
+
210
+ db.runCommand( {
211
+ collMod: "<collection_name>",
212
+ cappedSize: <max_size_in_bytes>,
213
+ cappedMax: <max_number_of_documents_in_collection>
214
+ } )
0 commit comments