Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions source/reference/command/collMod.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ collMod

.. code-block:: javascript

db.runCommand( {"collMod" : [collection] , "[flag]" : [value]" } )
db.runCommand( {"collMod" : <collection> , "<flag>" : <value> } )

In this command substitute ``[collection]`` with the name of the
collection, and ``[flag]`` and ``[value]`` with the flag and value
you want to set.
In this command substitute ``<collection>`` with the name of a
collection in the current database, and ``<flag>`` and ``<value>``
with the flag and value you want to set.

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

.. example::

Enable :collflag:`usePowerOf2Sizes` on the collection `sensor_readings`:

.. code-block:: javascript

db.runCommand({collMod: "sensor_readings", usePowerOf2Sizes:true })

Disable :collflag:`usePowerOf2Sizes` on the collection `products`:

.. code-block:: javascript

db.runCommand( { collMod: "products", "usePowerOf2Sizes": false })


.. note::
.. versionchanged:: 2.2.1
If you're using :collflag:`usePowerOf2Sizes`, ensure
Expand All @@ -51,6 +66,6 @@ collMod

.. Commenting out the following after DOCS-717, it does take
a lock but its to cover a very small metadata change.

This command obtains a write lock on the affected database
and will block other operations until it has completed.