blob: 226a4cfb1503e1c8d4fe71b1afcdb9583e7e768c (
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
|
// @tags: [requires_non_retryable_writes]
t = db.remove7;
t.drop();
function getTags(n) {
n = n || 5;
var a = [];
for (var i = 0; i < n; i++) {
var v = Math.ceil(20 * Math.random());
a.push(v);
}
return a;
}
for (i = 0; i < 1000; i++) {
t.save({tags: getTags()});
}
t.ensureIndex({tags: 1});
for (i = 0; i < 200; i++) {
for (var j = 0; j < 10; j++)
t.save({tags: getTags(100)});
var q = {tags: {$in: getTags(10)}};
var before = t.find(q).count();
var res = t.remove(q);
var after = t.find(q).count();
assert.eq(0, after, "not zero after!");
assert.writeOK(res);
}
|