Skip to content

Commit 72a324f

Browse files
author
Sam Kleinman
committed
merge: DOCS-524
2 parents 4ebce5c + 22c5f8c commit 72a324f

File tree

1 file changed

+23
-16
lines changed

1 file changed

+23
-16
lines changed

source/reference/command/compact.txt

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,44 +24,51 @@ compact
2424
You may also specify one of the following options:
2525

2626
- ``force: true``
27+
28+
.. versionchanged:: 2.2 :dbcommand:`compact` blocks activities only
29+
for its database.
2730

2831
To run on the primary node in a :term:`replica set`. Otherwise,
2932
the :dbcommand:`compact` command returns an error when invoked on
3033
a :term:`replica set` primary because the command blocks all other
3134
activity.
32-
33-
.. versionchanged:: 2.2 :dbcommand:`compact` blocks activities only
34-
for its database.
35-
35+
3636
- ``paddingFactor: <factor>``
37+
38+
.. versionadded:: v2.2
3739

3840
To specify a :term:`padding factor` ranging from 1.0 to 4.0 for
3941
the compacted documents. Default factor is 1.0, specifying no
4042
padding and the maximum padding factor is 4.0. If you do updates
4143
that increase the size of the documents, you will want some
42-
padding, especially if you have several indexes for the collection.
44+
padding, especially if you have several indexes for the
45+
collection. To set the padding factor to ``1.1`` on a collection
46+
named ``<collection>``, use the following operation:
4347

44-
.. versionadded:: v2.2
45-
46-
- ``paddingBytes: <bytes>``
48+
.. code-block:: javascript
49+
50+
db.runCommand ( { compact: '<collection>', paddingFactor: 1.1 } )
4751

52+
- ``paddingBytes: <bytes>``
53+
54+
.. versionadded:: 2.2
55+
4856
To specify a padding as an absolute number of bytes. Specifying
4957
``paddingBytes`` can be useful if your documents start small but
5058
then increase in size significantly. For example,if your documents
5159
are initially 40 bytes long and you grow them by 1KB, using
5260
``paddingBytes: 1024`` might be reasonable since using
5361
``paddingFactor: 4.0`` would only add 120 bytes (i.e. ``40 * (4.0 - 1)``)
54-
of padding.
62+
of padding.
5563

56-
.. versionadded:: 2.2
57-
58-
Using the following command, you can use the :dbcommand:`compact`
59-
command with the ``paddingBytes`` options to configure``100``
60-
bytes of padding by setting the ``paddingFactor`` to ``1.1``:
64+
With the following command, you can use the ``paddingBytes``
65+
option for the :dbcommand:`compact` command to set the padding
66+
size to ``100`` bytes on the collection named by
67+
``<collection>``:
6168

62-
.. code-block:: javascript
69+
.. code-block:: javascript
6370

64-
db.runCommand ( { compact: '<collection>', paddingBytes: 100, paddingFactor: 1.1 } )
71+
db.runCommand ( { compact: '<collection>', paddingBytes: 100 } )
6572

6673
.. warning::
6774

0 commit comments

Comments
 (0)