blob: dc3f84a9c346108888736a4c262876d942acfad5 (
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
33
34
35
36
37
38
39
40
|
// @tags: [
// requires_getmore,
// requires_non_retryable_writes,
// sbe_incompatible,
// uses_multiple_connections,
// uses_parallel_shell,
// ]
// SERVER-2009 Count odd numbered entries while updating and deleting even numbered entries.
(function() {
"use strict";
const t = db.jstests_remove9;
t.drop();
t.ensureIndex({i: 1});
const bulk = t.initializeUnorderedBulkOp();
for (let i = 0; i < 1000; ++i) {
bulk.insert({i: i});
}
assert.commandWorked(bulk.execute());
const s = startParallelShell(function() {
const t = db.jstests_remove9;
Random.setRandomSeed();
for (let j = 0; j < 5000; ++j) {
const i = Random.randInt(499) * 2;
t.update({i: i}, {$set: {i: 2000}});
t.remove({i: 2000});
t.save({i: i});
}
});
for (let i = 0; i < 1000; ++i) {
assert.eq(500, t.find({i: {$gte: 0, $mod: [2, 1]}}).hint({i: 1}).itcount());
}
s();
})();
|