@@ -24,44 +24,51 @@ compact
24
24
You may also specify one of the following options:
25
25
26
26
- ``force: true``
27
+
28
+ .. versionchanged:: 2.2 :dbcommand:`compact` blocks activities only
29
+ for its database.
27
30
28
31
To run on the primary node in a :term:`replica set`. Otherwise,
29
32
the :dbcommand:`compact` command returns an error when invoked on
30
33
a :term:`replica set` primary because the command blocks all other
31
34
activity.
32
-
33
- .. versionchanged:: 2.2 :dbcommand:`compact` blocks activities only
34
- for its database.
35
-
35
+
36
36
- ``paddingFactor: <factor>``
37
+
38
+ .. versionadded:: v2.2
37
39
38
40
To specify a :term:`padding factor` ranging from 1.0 to 4.0 for
39
41
the compacted documents. Default factor is 1.0, specifying no
40
42
padding and the maximum padding factor is 4.0. If you do updates
41
43
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:
43
47
44
- .. versionadded :: v2.2
45
-
46
- - ``paddingBytes: <bytes>``
48
+ .. code-block :: javascript
49
+
50
+ db.runCommand ( { compact: '<collection>', paddingFactor: 1.1 } )
47
51
52
+ - ``paddingBytes: <bytes>``
53
+
54
+ .. versionadded:: 2.2
55
+
48
56
To specify a padding as an absolute number of bytes. Specifying
49
57
``paddingBytes`` can be useful if your documents start small but
50
58
then increase in size significantly. For example,if your documents
51
59
are initially 40 bytes long and you grow them by 1KB, using
52
60
``paddingBytes: 1024`` might be reasonable since using
53
61
``paddingFactor: 4.0`` would only add 120 bytes (i.e. ``40 * (4.0 - 1)``)
54
- of padding.
62
+ of padding.
55
63
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>``:
61
68
62
- .. code-block:: javascript
69
+ .. code-block:: javascript
63
70
64
- db.runCommand ( { compact: '<collection>', paddingBytes: 100, paddingFactor: 1.1 } )
71
+ db.runCommand ( { compact: '<collection>', paddingBytes: 100 } )
65
72
66
73
.. warning::
67
74
0 commit comments