blob: 5b0fb6b8f8ef0c03ea2afbd0fbb491da600b54d1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
t = db.capped_empty;
t.drop();
db.createCollection( t.getName() , { capped : true , size : 100 } )
t.insert( { x : 1 } );
t.insert( { x : 2 } );
t.insert( { x : 3 } );
t.ensureIndex( { x : 1 } );
assert.eq( 3 , t.count() );
assert.eq( 1 , t.find( { x : 2 } ).explain().nscanned );
t.runCommand( "emptycapped" );
assert.eq( 0 , t.count() );
t.insert( { x : 1 } );
t.insert( { x : 2 } );
t.insert( { x : 3 } );
assert.eq( 3 , t.count() );
assert.eq( 1 , t.find( { x : 2 } ).explain().nscanned );
|