Skip to content

Commit 93c9962

Browse files
committed
DOCS-11585: mongos and metadata operations
1 parent ead1556 commit 93c9962

23 files changed

+248
-12
lines changed

source/core/sharded-cluster-query-router.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,3 +293,9 @@ to access individual shards.
293293

294294
See :doc:`/tutorial/enable-authentication` for a tutorial on enabling
295295
adding users to an RBAC-enabled MongoDB deployment.
296+
297+
Metadata Operations
298+
-------------------
299+
300+
.. include:: /includes/extracts/mongos-operations-wc.rst
301+

source/includes/apiargs-dbcommand-create-field.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,8 @@ description: |
189189
for the operation. Omit to use the default write
190190
concern.
191191
192+
.. include:: /includes/extracts/mongos-operations-wc-create.rst
193+
192194
optional: true
193195
arg_name: field
194196
type: document

source/includes/apiargs-dbcommand-renameCollection-field.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ description: |
4040
for the operation. Omit to use the default write
4141
concern.
4242
43+
.. include:: /includes/extracts/mongos-operations-wc-rename-collection.rst
44+
4345
optional: true
4446
arg_name: field
4547
type: document

source/includes/apiargs-method-db.createCollection-options-param.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,4 +280,19 @@ description: |
280280
281281
replacement:
282282
example: ":ref:`createCollection-collation-example`"
283+
---
284+
position: 15
285+
name: writeConcern
286+
description: |
287+
A document that expresses the :doc:`write concern </reference/write-concern>`
288+
for the operation. Omit to use the default write
289+
concern.
290+
291+
.. include:: /includes/extracts/mongos-operations-wc-create.rst
292+
293+
optional: true
294+
type: document
295+
interface: method
296+
operation: db.createCollection
297+
arg_name: field
283298
...
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
ref: mongos-operations-wc-move-primary
2+
content: |
3+
4+
:binary:`~bin.mongos` uses :writeconcern:`"majority"` for
5+
:dbcommand:`movePrimary`.
6+
7+
---
8+
ref: mongos-operations-wc-drop
9+
content: |
10+
11+
When issued on a sharded cluster, :binary:`~bin.mongos` converts the
12+
:doc:`write concern </reference/write-concern>` of the
13+
:dbcommand:`drop` command and its helper
14+
:method:`db.collection.drop()` to :writeconcern:`"majority"`.
15+
---
16+
ref: mongos-operations-wc-rename-collection
17+
content: |
18+
19+
When issued on a sharded cluster, :binary:`~bin.mongos` converts the
20+
:doc:`write concern </reference/write-concern>` of the
21+
:dbcommand:`renameCollection` command and its helper
22+
:method:`db.collection.renameCollection()` to
23+
:writeconcern:`"majority"`.
24+
25+
.. note::
26+
27+
You cannot rename a sharded collection. You can however rename an
28+
unsharded collection in a sharded cluster.
29+
30+
---
31+
ref: mongos-operations-wc-create
32+
content: |
33+
34+
When issued on a sharded cluster, :binary:`~bin.mongos` converts the
35+
:doc:`write concern </reference/write-concern>` of the
36+
:dbcommand:`create` command and its helper
37+
:method:`db.createCollection()` to :writeconcern:`"majority"`.
38+
---
39+
ref: mongos-operations-wc-drop-database
40+
content: |
41+
42+
When issued on a sharded cluster, MongoDB converts the :doc:`write
43+
concern </reference/write-concern>` of the :dbcommand:`dropDatabase`
44+
command to :writeconcern:`"majority"`.
45+
46+
---
47+
ref: mongos-operations-wc-shard-collection
48+
content: |
49+
50+
:binary:`~bin.mongos` uses :writeconcern:`"majority"` for the
51+
:doc:`write concern </reference/write-concern>` of the
52+
:dbcommand:`shardCollection` command and its helper
53+
:method:`sh.shardCollection()`.
54+
55+
---
56+
ref: mongos-operations-wc-enable-sharding
57+
content: |
58+
59+
:binary:`~bin.mongos` uses
60+
:writeconcern:`"majority"` for the
61+
:dbcommand:`enableSharding` command and its helper
62+
:method:`sh.enableSharding()`.
63+
---
64+
ref: mongos-operations-wc-add-shard
65+
content: |
66+
67+
:binary:`~bin.mongos` uses
68+
:writeconcern:`"majority"` for the
69+
:dbcommand:`addShard` command and its helper
70+
:method:`sh.addShard()`.
71+
72+
---
73+
ref: mongos-operations-wc-remove-shard
74+
content: |
75+
76+
:binary:`~bin.mongos` converts the
77+
:doc:`write concern </reference/write-concern>` of the
78+
:dbcommand:`removeShard` command to :writeconcern:`"majority"`.
79+
80+
---
81+
ref: mongos-operations-wc-fcv
82+
content: |
83+
When issued on a sharded cluster, :binary:`~bin.mongos` converts the
84+
:doc:`write concern </reference/write-concern>` of the
85+
:dbcommand:`setFeatureCompatibilityVersion` command to :writeconcern:`"majority"`.
86+
---
87+
ref: mongos-operations-wc
88+
content: |
89+
90+
:binary:`~bin.mongos` uses :writeconcern:`"majority"` for the
91+
following operations that affect the sharded cluster metadata:
92+
93+
.. list-table::
94+
:header-rows: 1
95+
96+
* - Command
97+
- Method
98+
- Note
99+
100+
* - :dbcommand:`addShard`
101+
- :method:`sh.addShard()`
102+
-
103+
104+
* - :dbcommand:`create`
105+
- :method:`db.createCollection()`
106+
-
107+
108+
* - :dbcommand:`drop`
109+
- :method:`db.collection.drop()`
110+
-
111+
112+
* - :dbcommand:`dropDatabase`
113+
114+
- :method:`db.dropDatabase()`
115+
116+
- Changed in MongoDB 3.6
117+
118+
* - :dbcommand:`enableSharding`
119+
- :method:`sh.enableSharding()`
120+
-
121+
122+
* - :dbcommand:`movePrimary`
123+
-
124+
-
125+
126+
* - :dbcommand:`renameCollection`
127+
- :method:`db.collection.renameCollection()`
128+
-
129+
130+
* - :dbcommand:`shardCollection`
131+
- :method:`sh.shardCollection()`
132+
-
133+
134+
* - :dbcommand:`removeShard`
135+
-
136+
-
137+
138+
* - :dbcommand:`setFeatureCompatibilityVersion`
139+
-
140+
-
141+
...
142+

source/includes/steps-convert-replica-set-enable-sharding.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ action:
2121
code: |
2222
sh.enableSharding( "test" )
2323
- pre: |
24+
.. include:: /includes/extracts/mongos-operations-wc-enable-sharding.rst
25+
2426
The operation returns the status of the operation:
2527
language: sh
2628
code: |
@@ -77,6 +79,9 @@ action:
7779
use test
7880
sh.shardCollection( "test.test_collection", { "number" : 1 } )
7981
- pre: |
82+
83+
.. include:: /includes/extracts/mongos-operations-wc-shard-collection.rst
84+
8085
The method returns the status of the operation:
8186
language: sh
8287
code: |

source/includes/steps-shard-a-collection-ranged.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ ref: shard-database
3434
pre: |
3535
Issue the :method:`sh.enableSharding()` method, specifying the name of the
3636
target database:
37+
3738
action:
3839
- pre: |
3940
language: javascript
@@ -46,6 +47,9 @@ action:
4647
code: |
4748
db.runCommand( { enableSharding : <database> } )
4849
post: |
50+
.. include:: /includes/extracts/mongos-operations-wc-enable-sharding.rst
51+
52+
4953
Enabling sharding on a database does *not* begin the sharding process.
5054
It only allows for collections within that database to be sharded.
5155
---
@@ -84,4 +88,7 @@ action:
8488
language: javascript
8589
code: |
8690
sh.shardCollection( "<database>.<collection>", { <shard key> : <direction> } )
91+
post: |
92+
.. include:: /includes/extracts/mongos-operations-wc-shard-collection.rst
93+
8794
...

source/reference/command/drop.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ drop
3636
- Optional. A document expressing the :doc:`write concern
3737
</reference/write-concern>` of the :dbcommand:`drop` command.
3838
Omit to use the default write concern.
39-
39+
40+
.. include:: /includes/extracts/mongos-operations-wc-drop.rst
4041

4142
The :binary:`~bin.mongo` shell provides the equivalent helper method
4243
:method:`db.collection.drop()`.
@@ -51,3 +52,6 @@ collection.
5152

5253
This command obtains a write lock on the affected database and
5354
will block other operations until it has completed.
55+
56+
57+

source/reference/command/dropDatabase.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ Definition
3939
</reference/write-concern>` of the :dbcommand:`drop` command.
4040
Omit to use the default write concern.
4141

42+
.. include:: /includes/extracts/mongos-operations-wc-drop-database.rst
43+
4244
The :binary:`~bin.mongo` shell also provides the helper method
4345
:method:`db.dropDatabase()`.
4446

@@ -50,10 +52,11 @@ Behavior
5052
.. include:: /includes/fact-drop-database-users.rst
5153

5254
.. versionchanged:: 3.6
53-
55+
5456
:dbcommand:`dropDatabase` waits until all collections drops in the
5557
database have propagated to a majority of the replica set members.
5658

59+
5760
Example
5861
-------
5962

source/reference/command/enableSharding.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ enableSharding
2626
To run :dbcommand:`enableSharding`, connect to a :binary:`~bin.mongos`
2727
instance and run the command in the ``admin`` database.
2828

29+
.. include:: /includes/extracts/mongos-operations-wc-enable-sharding.rst
30+
2931
:returns:
3032
A document that contains status of the operation.
3133

0 commit comments

Comments
 (0)