Skip to content

Commit 9288cf9

Browse files
author
Ed Costello
committed
DOCS-841 add examples for usePowerOf2Sizes, remove random double quote
1 parent 77342ba commit 9288cf9

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

source/reference/command/collMod.txt

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ collMod
1515

1616
.. code-block:: javascript
1717

18-
db.runCommand( {"collMod" : [collection] , "[flag]" : [value]" } )
18+
db.runCommand( {"collMod" : [collection] , "[flag]" : [value] } )
1919

20-
In this command substitute ``[collection]`` with the name of the
21-
collection, and ``[flag]`` and ``[value]`` with the flag and value
22-
you want to set.
20+
In this command substitute ``[collection]`` with the name of a
21+
collection in the current database, and ``[flag]`` and ``[value]``
22+
with the flag and value you want to set.
2323

2424
.. index:: document; space allocation
2525
.. index:: usePowerOf2Sizes
@@ -38,6 +38,21 @@ collMod
3838
will be inserting and deleting large numbers of documents to
3939
ensure that MongoDB will effectively use space on disk.
4040

41+
.. example::
42+
43+
Enable :collflag:`usePowerOf2Sizes` on the collection `sensor_readings`:
44+
45+
.. code-block:: javascript
46+
47+
db.runCommand({collMod: "sensor_readings", usePowerOf2Sizes:true })
48+
49+
Disable :collflag:`usePowerOf2Sizes` on the collection `products`:
50+
51+
.. code-block:: javascript
52+
53+
db.runCommand( { collMod: "products", "usePowerOf2Sizes": false })
54+
55+
4156
.. note::
4257
.. versionchanged:: 2.2.1
4358
If you're using :collflag:`usePowerOf2Sizes`, ensure
@@ -51,6 +66,6 @@ collMod
5166

5267
.. Commenting out the following after DOCS-717, it does take
5368
a lock but its to cover a very small metadata change.
54-
69+
5570
This command obtains a write lock on the affected database
5671
and will block other operations until it has completed.

0 commit comments

Comments
 (0)