【问题标题】:Size of MongoDB capped collection is not right?MongoDB capped collection 的大小不对?
【发布时间】:2014-09-11 16:08:18
【问题描述】:

我有一个上限收藏。当我在其上调用 stats() 时,我得到以下输出:

/* 0 */
{
    "ns" : "log_db.access_logs",
    "count" : 42088,
    "size" : 13602632,
    "avgObjSize" : 323,
    "storageSize" : 100003840,
    "numExtents" : 1,
    "nindexes" : 2,
    "lastExtentSize" : 100003840,
    "paddingFactor" : 1,
    "systemFlags" : 1,
    "userFlags" : 0,
    "totalIndexSize" : 3932656,
    "indexSizes" : {
        "_id_" : 1389920,
        "apikey_1_ts_1" : 2542736
    },
    "capped" : true,
    "max" : NumberLong(9223372036854775807),
    "ok" : 1
}

我不知道'max'参数显示的是什么。我使用 db.runCommand('convertToCapped' ... ) 构造创建了这个集合,并且我将 'size' 参数设置为 1 亿。但是这里没有提到它(大小)

有人可以在这里解释“最大”字段的含义以及如何找到封顶集合的正确大小。

【问题讨论】:

    标签: mongodb capped-collections


    【解决方案1】:

    我曾经有过这个确切的问题,因为它不在文档中,这是我从 10gen (MongoDB Inc) 员工mongodb capped collection is not using all available space 那里得到的答案:

    max 属性是上限集合中允许的(可选)最大文档数(请参阅 db.createCollection())。如果您没有指定最大值,它将被设置为 MAXINT(在您的示例中,有符号 Int64 的最大正值)。由于上限集合的空间始终是预先分配的,因此大小限制优先于最大文档数。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-07-16
      • 1970-01-01
      • 2017-07-21
      • 2016-02-25
      • 2018-01-31
      • 2011-08-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多