@@ -15,11 +15,11 @@ collMod
15
15
16
16
.. code-block:: javascript
17
17
18
- db.runCommand( {"collMod" : [collection] , "[flag]" : [value]" } )
18
+ db.runCommand( {"collMod" : [collection] , "[flag]" : [value] } )
19
19
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.
23
23
24
24
.. index:: document; space allocation
25
25
.. index:: usePowerOf2Sizes
@@ -38,6 +38,21 @@ collMod
38
38
will be inserting and deleting large numbers of documents to
39
39
ensure that MongoDB will effectively use space on disk.
40
40
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
+
41
56
.. note::
42
57
.. versionchanged:: 2.2.1
43
58
If you're using :collflag:`usePowerOf2Sizes`, ensure
@@ -51,6 +66,6 @@ collMod
51
66
52
67
.. Commenting out the following after DOCS-717, it does take
53
68
a lock but its to cover a very small metadata change.
54
-
69
+
55
70
This command obtains a write lock on the affected database
56
71
and will block other operations until it has completed.
0 commit comments