Skip to content

Commit 3a3268e

Browse files
authored
DOCSP-21622 adds syntax sections to command pages A-C (#920)
* adding syntax sections as needed * review feedback * delete create and createIndexes temporarily * re-adds create and createIndexes * re-adds create * re-adds createIndexes * cleanup * spacing fix * fixes create * fixes createIndexes * spacing * removes create.txt and createIndexes.txt as they have gotten out of date * Delete create.txt * re-adds create and createIndexes updated from master * readds create * create * createIndexes
1 parent 0a02db5 commit 3a3268e

29 files changed

+1816
-1616
lines changed

source/reference/command/abortReshardCollection.txt

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,6 @@ Definition
2121
abort the operation with the :dbcommand:`abortReshardCollection`
2222
command.
2323

24-
The command has the following syntax:
25-
26-
.. code-block:: javascript
27-
28-
{
29-
abortReshardCollection: "<database>.<collection>"
30-
}
31-
3224
You can abort a :ref:`resharding operation <sharding-resharding>` at
3325
any point until the :ref:`commit phase
3426
<resharding-commit-phase-command>`. If the :ref:`resharding operation
@@ -39,6 +31,19 @@ Definition
3931

4032
The :binary:`~bin.mongosh` provides a wrapper method
4133
:method:`sh.abortReshardCollection()`.
34+
35+
Syntax
36+
------
37+
38+
The command has the following syntax:
39+
40+
.. code-block:: javascript
41+
42+
db.adminCommand(
43+
{
44+
abortReshardCollection: "<database>.<collection>"
45+
}
46+
)
4247

4348
Example
4449
-------

source/reference/command/abortTransaction.txt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,22 @@ Definition
3030
:binary:`~bin.mongosh` :method:`Session.abortTransaction()`
3131
helper.
3232

33-
The command has the following syntax:
33+
Syntax
34+
------
3435

35-
.. code-block:: javascript
36+
The command has the following syntax:
3637

37-
{
38+
.. code-block:: javascript
39+
40+
db.adminCommand(
41+
{
3842
abortTransaction: 1,
3943
txnNumber: <long>,
4044
writeConcern: <document>,
4145
autocommit: false,
4246
comment: <any>
4347
}
48+
)
4449

4550
Behavior
4651
--------

source/reference/command/addShard.txt

Lines changed: 74 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -18,70 +18,80 @@ Definition
1818
Adds a shard replica set to a :term:`sharded cluster`.
1919

2020
Run :dbcommand:`addShard` when connected to a :binary:`~bin.mongos`
21-
instance. The command takes the following form to add a shard
22-
replica set:
23-
24-
.. code-block:: javascript
25-
26-
{ addShard: "<replica_set>/<hostname><:port>", maxSize: <size>, name: "<shard_name>" }
27-
28-
The command contains the following fields:
29-
30-
31-
.. list-table::
32-
:header-rows: 1
33-
:widths: 20 20 80
34-
35-
* - Field
36-
37-
- Type
38-
39-
- Description
40-
41-
* - ``addShard``
42-
43-
- string
44-
45-
- The replica set name, hostname, and port of at least one member of
46-
the shard's replica set. Any additional replica set member hostnames
47-
must be comma separated. For example:
48-
49-
.. code-block:: bash
50-
51-
<replica_set>/<hostname><:port>,<hostname><:port>, ...
52-
53-
54-
55-
* - ``maxSize``
56-
57-
- integer
58-
59-
- Optional. The maximum size in megabytes of the shard. If you set ``maxSize``
60-
to ``0``, MongoDB does not limit the size of the shard.
61-
62-
63-
64-
* - ``name``
65-
66-
- string
67-
68-
- Optional. A name for the shard. If this is not specified, MongoDB
69-
automatically provides a unique name.
70-
71-
72-
73-
74-
75-
The :dbcommand:`addShard` command stores shard configuration
76-
information in the :term:`config database`. Always run
77-
:dbcommand:`addShard` when using the ``admin`` database.
78-
79-
Specify a ``maxSize`` when you have machines with different disk
80-
capacities, or if you want to limit the amount of data on some
81-
shards. The ``maxSize`` constraint prevents the :term:`balancer`
82-
from migrating chunks to the shard when the ``totalSize`` returned
83-
from running :dbcommand:`listDatabases` on the shard exceeds the
84-
value of ``maxSize``.
21+
instance.
22+
23+
Syntax
24+
------
25+
26+
The command has the following syntax:
27+
28+
.. code-block:: javascript
29+
30+
db.adminCommand(
31+
{
32+
addShard: "<replica_set>/<hostname><:port>",
33+
maxSize: <size>,
34+
name: "<shard_name>"
35+
}
36+
)
37+
38+
Command Fields
39+
~~~~~~~~~~~~~~
40+
41+
The command contains the following fields:
42+
43+
44+
.. list-table::
45+
:header-rows: 1
46+
:widths: 20 20 80
47+
48+
* - Field
49+
50+
- Type
51+
52+
- Description
53+
54+
* - ``addShard``
55+
56+
- string
57+
58+
- The replica set name, hostname, and port of at least one member of
59+
the shard's replica set. Any additional replica set member hostnames
60+
must be comma separated. For example:
61+
62+
.. code-block:: bash
63+
64+
<replica_set>/<hostname><:port>,<hostname><:port>, ...
65+
66+
67+
68+
* - ``maxSize``
69+
70+
- integer
71+
72+
- Optional. The maximum size in megabytes of the shard. If you set ``maxSize``
73+
to ``0``, MongoDB does not limit the size of the shard.
74+
75+
76+
77+
* - ``name``
78+
79+
- string
80+
81+
- Optional. A name for the shard. If this is not specified, MongoDB
82+
automatically provides a unique name.
83+
84+
85+
The :dbcommand:`addShard` command stores shard configuration
86+
information in the :term:`config database`. Always run
87+
:dbcommand:`addShard` when using the ``admin`` database.
88+
89+
Specify a ``maxSize`` when you have machines with different disk
90+
capacities, or if you want to limit the amount of data on some
91+
shards. The ``maxSize`` constraint prevents the :term:`balancer`
92+
from migrating chunks to the shard when the ``totalSize`` returned
93+
from running :dbcommand:`listDatabases` on the shard exceeds the
94+
value of ``maxSize``.
8595

8696

8797
Considerations

source/reference/command/addShardToZone.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ Definition
2121

2222
.. |command| replace:: ``addShardToZone``
2323

24-
Syntax
25-
------
26-
2724
You can only run :dbcommand:`addShardToZone` on the ``admin`` database
2825
from a :binary:`~bin.mongos` instance.
26+
27+
Syntax
28+
------
2929

30-
The :dbcommand:`addShardToZone` command has the following syntax:
30+
The command has the following syntax:
3131

3232
.. code-block:: javascript
3333

@@ -38,8 +38,8 @@ The :dbcommand:`addShardToZone` command has the following syntax:
3838
}
3939
)
4040

41-
Fields
42-
~~~~~~
41+
Command Fields
42+
~~~~~~~~~~~~~~
4343

4444
The command takes the following fields:
4545

@@ -74,7 +74,7 @@ The command takes the following fields:
7474

7575

7676
:binary:`~bin.mongosh` provides the helper method
77-
:method:`sh.addShardToZone()`
77+
:method:`sh.addShardToZone()`.
7878

7979
Behavior
8080
--------

source/reference/command/aggregate.txt

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,25 +25,27 @@ Syntax
2525

2626
.. versionchanged:: 5.0
2727

28-
The command has following syntax:
28+
The command has the following syntax:
2929

3030
.. code-block:: javascript
31-
32-
{
33-
aggregate: "<collection>" || 1,
34-
pipeline: [ <stage>, <...> ],
35-
explain: <boolean>,
36-
allowDiskUse: <boolean>,
37-
cursor: <document>,
38-
maxTimeMS: <int>,
39-
bypassDocumentValidation: <boolean>,
40-
readConcern: <document>,
41-
collation: <document>,
42-
hint: <string or document>,
43-
comment: <any>,
44-
writeConcern: <document>,
45-
let: <document> // Added in MongoDB 5.0
46-
}
31+
32+
db.runCommand(
33+
{
34+
aggregate: "<collection>" || 1,
35+
pipeline: [ <stage>, <...> ],
36+
explain: <boolean>,
37+
allowDiskUse: <boolean>,
38+
cursor: <document>,
39+
maxTimeMS: <int>,
40+
bypassDocumentValidation: <boolean>,
41+
readConcern: <document>,
42+
collation: <document>,
43+
hint: <string or document>,
44+
comment: <any>,
45+
writeConcern: <document>,
46+
let: <document> // Added in MongoDB 5.0
47+
}
48+
)
4749

4850
.. tip::
4951

source/reference/command/balancerCollectionStatus.txt

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,23 @@ Definition
2626
You can only issue the :dbcommand:`balancerCollectionStatus` against the
2727
``admin`` database.
2828

29-
The command takes the following form:
29+
Syntax
30+
------
3031

31-
.. code-block:: javascript
32+
The command has the following syntax:
3233

33-
db.adminCommand( { balancerCollectionStatus: "<db>.<collection>" } )
34-
35-
Specify the full namespace ("<db>.<collection>") of the sharded collection.
36-
37-
:binary:`~bin.mongosh` provides a wrapper method
38-
:method:`sh.balancerCollectionStatus()`.
34+
.. code-block:: javascript
35+
36+
db.adminCommand(
37+
{
38+
balancerCollectionStatus: "<db>.<collection>"
39+
}
40+
)
41+
42+
Specify the full namespace (``"<db>.<collection>"``) of the sharded collection.
43+
44+
:binary:`~bin.mongosh` provides a wrapper method
45+
:method:`sh.balancerCollectionStatus()`.
3946

4047
Access Control
4148
--------------

source/reference/command/balancerStart.txt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,19 @@ You can only issue the
2929
:dbcommand:`balancerStart` against the ``admin`` database on a
3030
:binary:`~bin.mongos` instance.
3131

32-
The command takes the following form:
32+
The command has the following syntax:
3333

3434
.. code-block:: javascript
3535

36-
db.adminCommand( { balancerStart: 1, maxTimeMS: <number> } )
36+
db.adminCommand(
37+
{
38+
balancerStart: 1,
39+
maxTimeMS: <number>
40+
}
41+
)
3742

43+
Command Fields
44+
~~~~~~~~~~~~~~
3845

3946
.. list-table::
4047
:header-rows: 1

source/reference/command/balancerStatus.txt

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,18 @@ Definition
2121
You can only issue the :dbcommand:`balancerStatus` against the
2222
``admin`` database.
2323

24-
The command takes the following form:
24+
Syntax
25+
------
2526

26-
.. code-block:: javascript
27+
The command has the following syntax:
2728

28-
db.adminCommand( { balancerStatus: 1 } )
29+
.. code-block:: javascript
30+
31+
db.adminCommand(
32+
{
33+
balancerStatus: 1
34+
}
35+
)
2936

3037
Output Document
3138
---------------

0 commit comments

Comments
 (0)