The command has the following syntax:
The command takes the following fields:
Field Description cloneCollectionAsCapped The name of the existing collection to copy. toCollection
The name of the new capped collection to create.
The name of the new capped collection must be distinct and cannot be the same as that of the original existing collection.
size The maximum size,in bytes, for the capped collection. writeConcern Optional. A document expressing the write concern of the
dropcommand. Omit to use the default write concern.
The command copies an
existing collectionand creates a new
capped collectionwith a maximum size specified by the
capped sizein bytes.
To replace the original non-capped collection with a capped collection, use the
capped size is less than the size of the source collection, then not all documents in the source collection will exist in the destination capped collection.
This holds a database exclusive lock for the duration of the operation. Other operations which lock the same database will be blocked until the operation completes. See What locks are taken by some common client operations? for operations that lock the database.