2012-11-20 16:29:52 +01:00
|
|
|
|
|
|
|
t = db.capped_max;
|
|
|
|
sz = 1024 * 16;
|
|
|
|
|
|
|
|
t.drop();
|
2016-03-09 18:17:50 +01:00
|
|
|
db.createCollection(t.getName(), {capped: true, size: sz});
|
|
|
|
assert.lt(Math.pow(2, 62), t.stats().max.floatApprox);
|
2012-11-20 16:29:52 +01:00
|
|
|
|
|
|
|
t.drop();
|
2016-03-09 18:17:50 +01:00
|
|
|
db.createCollection(t.getName(), {capped: true, size: sz, max: 123456});
|
|
|
|
assert.eq(123456, t.stats().max);
|
2012-11-20 16:29:52 +01:00
|
|
|
|
2012-12-04 22:46:51 +01:00
|
|
|
// create a collection with the max possible doc cap (2^31-2 docs)
|
2012-11-20 20:26:09 +01:00
|
|
|
t.drop();
|
2012-12-04 22:46:51 +01:00
|
|
|
mm = Math.pow(2, 31) - 2;
|
2016-03-09 18:17:50 +01:00
|
|
|
db.createCollection(t.getName(), {capped: true, size: sz, max: mm});
|
|
|
|
assert.eq(mm, t.stats().max);
|
2012-11-20 20:26:09 +01:00
|
|
|
|
2012-12-04 22:46:51 +01:00
|
|
|
// create a collection with the 'no max' value (2^31-1 docs)
|
|
|
|
t.drop();
|
|
|
|
mm = Math.pow(2, 31) - 1;
|
2016-03-09 18:17:50 +01:00
|
|
|
db.createCollection(t.getName(), {capped: true, size: sz, max: mm});
|
|
|
|
assert.eq(NumberLong("9223372036854775807"), t.stats().max);
|
2012-12-04 22:46:51 +01:00
|
|
|
|
2012-11-20 16:29:52 +01:00
|
|
|
t.drop();
|
2016-03-09 18:17:50 +01:00
|
|
|
res = db.createCollection(t.getName(), {capped: true, size: sz, max: Math.pow(2, 31)});
|
|
|
|
assert.eq(0, res.ok, tojson(res));
|
|
|
|
assert.eq(0, t.stats().ok);
|