Docs HomeMongoDB Compass

Create a Capped Collection创建封顶集合

Capped Collections are fixed-sized collections that support high-throughput operations that insert and retrieve documents based on insertion order.封顶集合是固定大小的集合,支持基于插入顺序插入和检索文档的高吞吐量操作。

Procedure过程

1

Click the Create Collection button.单击“创建集合”按钮。

From the Collections screen, click the Create Collection button.在“集合”屏幕中,单击“创建集合”按钮。

2

Enter the collection name.输入集合名称。

3

Click the Advanced Collection Options dropdown.单击“高级集合选项”下拉列表。

Check the Capped Collection option.选中“封顶集合”选项。

4

Enter the size of the capped collection.输入封顶集合的“大小”。

Enter the maximum number of bytes that the collection can hold.输入集合可以容纳的最大字节数。

5

Click Create Collection to create the collection.单击“创建集合”以创建集合。

Restrictions and Limitations限制和局限性

The following restrictions and limitations apply when creating a capped collection:创建有上限的集合时,以下限制和限制适用:

  • Custom collation is the only Advanced Collection Option that can be used alongside your capped collection.“自定义排序规则”是唯一可以与封顶集合一起使用的“高级集合选项”。
  • If you import a data set larger than the maximum size of the capped collection, Compass only loads the last documents of the data set and drops the oldest documents.如果导入的数据集大于上限集合的最大大小,Compass将仅加载数据集的最后一个文档,并删除最旧的文档。
  • Once the collection is created, you cannot adjust the maximum number of bytes.一旦创建了集合,就无法调整最大字节数。