summaryrefslogtreecommitdiff
path: root/jstests/core/cappeda.js
blob: 79df5f33aa6cec5851d113e99bf7e2e3e0f28f56 (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
25
26
27
28
29
30
31
32

t = db.scan_capped_id;
t.drop();

x = t.runCommand( "create" , { capped : true , size : 10000 } );
assert( x.ok );

for ( i=0; i<100; i++ )
    t.insert( { _id : i , x : 1 } );

function q() {
    return t.findOne( { _id : 5 } );
}

function u() {
    var res = t.update( { _id : 5 } , { $set : { x : 2 } } );
    if ( res.hasWriteError() )
        throw res;
}
    

// SERVER-3064
//assert.throws( q , [] , "A1" );
//assert.throws( u , [] , "B1" );

t.ensureIndex( { _id : 1 } );

assert.eq( 1 , q().x );
q();
u();

assert.eq( 2 , q().x );