发布于 2015-09-14 15:03:50 | 131 次阅读 | 评论: 0 | 来源: 网络整理

cloneCollectionAsCapped

The cloneCollectionAsCapped command creates a new capped collection from an existing, non-capped collection within the same database. The operation does not affect the original non-capped collection.

The command has the following syntax:

{ cloneCollectionAsCapped: <existing collection>, toCollection: <capped collection>, size: <capped size> }

The command copies an existing collection and creates a new capped collection with a maximum size specified by the capped size in bytes. The name of the new capped collection must be distinct and cannot be the same as that of the original existing collection. To replace the original non-capped collection with a capped collection, use the convertToCapped command.

During the cloning, the cloneCollectionAsCapped command exhibit the following behavior:

  • MongoDB will transverse the documents in the original collection in natural order as they’re loaded.
  • If the capped size specified for the new collection is smaller than the size of the original uncapped collection, then MongoDB will begin overwriting earlier documents in insertion order, which is first in, first out (e.g “FIFO”).
最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务