2012-06-03 17:29:15 -04:00
|
|
|
|
|
|
|
|
t = db.capped_empty;
|
|
|
|
|
t.drop();
|
|
|
|
|
|
2016-03-09 12:17:50 -05:00
|
|
|
db.createCollection(t.getName(), {capped: true, size: 100});
|
2012-06-03 17:29:15 -04:00
|
|
|
|
2016-03-09 12:17:50 -05:00
|
|
|
t.insert({x: 1});
|
|
|
|
|
t.insert({x: 2});
|
|
|
|
|
t.insert({x: 3});
|
|
|
|
|
t.ensureIndex({x: 1});
|
2012-06-03 17:29:15 -04:00
|
|
|
|
2016-03-09 12:17:50 -05:00
|
|
|
assert.eq(3, t.count());
|
2012-06-03 17:29:15 -04:00
|
|
|
|
2016-03-09 12:17:50 -05:00
|
|
|
t.runCommand("emptycapped");
|
2012-06-03 17:29:15 -04:00
|
|
|
|
2016-03-09 12:17:50 -05:00
|
|
|
assert.eq(0, t.count());
|
2012-06-03 17:29:15 -04:00
|
|
|
|
2016-03-09 12:17:50 -05:00
|
|
|
t.insert({x: 1});
|
|
|
|
|
t.insert({x: 2});
|
|
|
|
|
t.insert({x: 3});
|
2012-06-03 17:29:15 -04:00
|
|
|
|
2016-03-09 12:17:50 -05:00
|
|
|
assert.eq(3, t.count());
|