summaryrefslogtreecommitdiff
path: root/jstests/slowWeekly/update_server-5552.js
blob: d1f1bcb518b32d74dd1796b306eb4ac423a8bc4e (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


load( "jstests/libs/slow_weekly_util.js" )
testServer = new SlowWeeklyMongod( "update_server-5552" )
db = testServer.getDB( "test" );

t = db.foo;
t.drop()

N = 10000;

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

join = startParallelShell( "while( db.foo.findOne( { _id : 0 } ).x == 1 ); db.foo.ensureIndex( { x : 1 } );" )

t.update( { $where : function(){ sleep(1); return true; } } , { $set : { x : 5 } } , false , true );
db.getLastError();

join();

assert.eq( N , t.find( { x : 5 } ).count() );

testServer.stop();