@@ -7,21 +7,36 @@ convertToCapped
77.. dbcommand:: convertToCapped
88
99 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:
1213
1314 .. code-block:: javascript
1415
15- {convertToCapped: " collection" , size: 100 * 1024 }
16+ {convertToCapped: < collection> , size: <capped size> }
1617
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).
2133
2234 .. warning::
2335
2436 The :dbcommand:`convertToCapped` will not recreate indexes from
2537 the original collection on the new collection. If you need
2638 indexes on this collection you will need to create these indexes
2739 after the conversion is complete.
40+
41+ .. seealso:: :dbcommand:`create`
42+
0 commit comments