@@ -7,21 +7,36 @@ convertToCapped
7
7
.. dbcommand:: convertToCapped
8
8
9
9
The :dbcommand:`convertToCapped` command converts an existing,
10
- non-capped collection to a :term:`capped collection`. Use the
11
- following syntax:
10
+ non-capped collection to a :term:`capped collection`.
11
+
12
+ The command has the following syntax:
12
13
13
14
.. code-block:: javascript
14
15
15
- {convertToCapped: " collection" , size: 100 * 1024 }
16
+ {convertToCapped: < collection> , size: <capped size> }
16
17
17
- This command coverts ``collection``, an existing collection, to a
18
- capped collection, with a maximum size of 100 KB. This command
19
- accepts the ``size`` and ``max`` options. See the
20
- :dbcommand:`create` command for additional details.
18
+ This command coverts an existing ``collection`` to a capped
19
+ collection with a maximum size specified by the ``capped size`` in
20
+ bytes.
21
+
22
+ During the conversion, the :dbcommand:`convertToCapped` command
23
+ exhibit the following behavior:
24
+
25
+ - The documents in the original collection will be traversed in
26
+ :term:`$natural order <natural order>` and loaded into a new
27
+ capped collection.
28
+
29
+ - If the ``capped size`` specified for the capped collection is
30
+ smaller than the size of the original uncapped collection, then
31
+ the documents will be aged out of the collection based on
32
+ insertion order(First In, First Out).
21
33
22
34
.. warning::
23
35
24
36
The :dbcommand:`convertToCapped` will not recreate indexes from
25
37
the original collection on the new collection. If you need
26
38
indexes on this collection you will need to create these indexes
27
39
after the conversion is complete.
40
+
41
+ .. seealso:: :dbcommand:`create`
42
+
0 commit comments