summaryrefslogtreecommitdiff
path: root/jstests/core/remove9.js
blob: e7c0373972cb16c4ae41d1d54071efe73499a949 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// @tags: [requires_getmore, requires_non_retryable_writes]

// SERVER-2009 Count odd numbered entries while updating and deleting even numbered entries.

t = db.jstests_remove9;
t.drop();
t.ensureIndex({i: 1});
for (i = 0; i < 1000; ++i) {
    t.save({i: i});
}

s = startParallelShell(
    't = db.jstests_remove9; Random.setRandomSeed(); for( j = 0; j < 5000; ++j ) { i = Random.randInt( 499 ) * 2; t.update( {i:i}, {$set:{i:2000}} ); t.remove( {i:2000} ); t.save( {i:i} ); }');

for (i = 0; i < 1000; ++i) {
    assert.eq(500, t.find({i: {$gte: 0, $mod: [2, 1]}}).hint({i: 1}).itcount());
}

s();