Skip to content

DOCS-557 add note to convertToCapped #275

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 2, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 27 additions & 7 deletions source/reference/command/convertToCapped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,41 @@ convertToCapped
.. dbcommand:: convertToCapped

The :dbcommand:`convertToCapped` command converts an existing,
non-capped collection to a :term:`capped collection`. Use the
following syntax:
non-capped collection to a :term:`capped collection`.

The command has the following syntax:

.. code-block:: javascript

{convertToCapped: "collection", size: 100 * 1024 }
{convertToCapped: <collection>, size: <capped size> }

This command coverts an existing ``collection`` to a capped
collection with a maximum size specified by the ``capped size`` in
bytes.

During the conversion, the :dbcommand:`convertToCapped` command
exhibit the following behavior:

- The documents in the original collection will be traversed in
:term:`$natural order <natural order>` and loaded into a new
capped collection.

This command coverts ``collection``, an existing collection, to a
capped collection, with a maximum size of 100 KB. This command
accepts the ``size`` and ``max`` options. See the
:dbcommand:`create` command for additional details.
- If the ``capped size`` specified for the capped collection is
smaller than the size of the original uncapped collection, then
the documents will be aged out of the collection based on
insertion order(First In, First Out).

.. note::

The :dbcommand:`convertToCapped` command is not supported in a
sharded cluster.

.. warning::

The :dbcommand:`convertToCapped` will not recreate indexes from
the original collection on the new collection. If you need
indexes on this collection you will need to create these indexes
after the conversion is complete.

.. seealso:: :dbcommand:`create`