@@ -22,74 +22,91 @@ convertToCapped
22
22
non-capped collection to a :term:`capped collection` within the same
23
23
database.
24
24
25
- The command has the following syntax:
26
-
27
- .. code-block:: javascript
28
-
29
- { convertToCapped: <collection>,
30
- size: <capped size>,
31
- writeConcern: <document>,
32
- comment: <any>
33
- }
34
-
35
- The command takes the following fields:
36
-
37
- .. list-table::
38
- :header-rows: 1
39
- :widths: 20 80
40
-
41
- * - Field
42
- - Description
43
-
44
- * - convertToCapped
45
- - The name of the existing collection to convert.
46
-
47
- * - size
48
- - The maximum size, in bytes, for the capped collection.
49
-
50
- * - writeConcern
51
-
52
- - Optional. A document expressing the :doc:`write concern
53
- </reference/write-concern>` of the :dbcommand:`drop` command.
54
- Omit to use the default write concern.
55
-
56
- * - ``comment``
57
-
58
- - .. include:: /includes/extracts/comment-content.rst
59
-
60
- :dbcommand:`convertToCapped` takes an existing collection
61
- (``<collection>``) and transforms it into a capped collection with
62
- a maximum size in bytes, specified by the ``size`` argument
63
- (``<capped size>``).
64
-
65
- During the conversion process, the :dbcommand:`convertToCapped`
66
- command exhibits the following behavior:
67
-
68
- - MongoDB traverses the documents in the original collection in
69
- :term:`natural order` and loads the documents into a new
70
- capped collection.
71
-
72
- - If the ``capped size`` specified for the capped collection is
73
- smaller than the size of the original uncapped collection, then
74
- MongoDB will overwrite documents in the capped collection based
75
- on insertion order, or *first in, first out* order.
76
-
77
- - Internally, to convert the collection, MongoDB uses the following
78
- procedure
79
-
80
- - :dbcommand:`cloneCollectionAsCapped` command creates the capped
81
- collection and imports the data.
82
-
83
- - MongoDB drops the original collection.
84
-
85
- - :dbcommand:`renameCollection` renames the new capped collection
86
- to the name of the original collection.
87
-
88
- - .. include:: /includes/fact-database-lock.rst
89
-
90
- .. warning::
91
-
92
- .. include:: /includes/fact-convertToCapped-indexes.rst
25
+ Compatibility
26
+ -------------
27
+
28
+ This command is available in deployments hosted in the following environments:
29
+
30
+ .. include:: /includes/fact-environments-atlas-only.rst
31
+
32
+ .. include:: /includes/fact-environments-atlas-support-no-serverless.rst
33
+
34
+ .. include:: /includes/fact-environments-onprem-only.rst
35
+
36
+ Syntax
37
+ ------
38
+
39
+ The command has the following syntax:
40
+
41
+ .. code-block:: javascript
42
+
43
+ { convertToCapped: <collection>,
44
+ size: <capped size>,
45
+ writeConcern: <document>,
46
+ comment: <any>
47
+ }
48
+
49
+ Command Fields
50
+ ~~~~~~~~~~~~~~
51
+
52
+ The command takes the following fields:
53
+
54
+ .. list-table::
55
+ :header-rows: 1
56
+ :widths: 20 80
57
+
58
+ * - Field
59
+ - Description
60
+
61
+ * - convertToCapped
62
+ - The name of the existing collection to convert.
63
+
64
+ * - size
65
+ - The maximum size, in bytes, for the capped collection.
66
+
67
+ * - writeConcern
68
+
69
+ - Optional. A document expressing the :doc:`write concern
70
+ </reference/write-concern>` of the :dbcommand:`drop` command.
71
+ Omit to use the default write concern.
72
+
73
+ * - ``comment``
74
+
75
+ - .. include:: /includes/extracts/comment-content.rst
76
+
77
+ :dbcommand:`convertToCapped` takes an existing collection
78
+ (``<collection>``) and transforms it into a capped collection with
79
+ a maximum size in bytes, specified by the ``size`` argument
80
+ (``<capped size>``).
81
+
82
+ During the conversion process, the :dbcommand:`convertToCapped`
83
+ command exhibits the following behavior:
84
+
85
+ - MongoDB traverses the documents in the original collection in
86
+ :term:`natural order` and loads the documents into a new
87
+ capped collection.
88
+
89
+ - If the ``capped size`` specified for the capped collection is
90
+ smaller than the size of the original uncapped collection, then
91
+ MongoDB will overwrite documents in the capped collection based
92
+ on insertion order, or *first in, first out* order.
93
+
94
+ - Internally, to convert the collection, MongoDB uses the following
95
+ procedure
96
+
97
+ - :dbcommand:`cloneCollectionAsCapped` command creates the capped
98
+ collection and imports the data.
99
+
100
+ - MongoDB drops the original collection.
101
+
102
+ - :dbcommand:`renameCollection` renames the new capped collection
103
+ to the name of the original collection.
104
+
105
+ - .. include:: /includes/fact-database-lock.rst
106
+
107
+ .. warning::
108
+
109
+ .. include:: /includes/fact-convertToCapped-indexes.rst
93
110
94
111
Example
95
112
-------
0 commit comments