summaryrefslogtreecommitdiff
path: root/jstests/core/pullall2.js
blob: 10e8c89caa16b4a442e56cc115d0024ee7459e82 (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
// Cannot implicitly shard accessed collections because of following errmsg: A single
// update/delete on a sharded collection must contain an exact match on _id or contain the shard
// key.
// @tags: [assumes_unsharded_collection]

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

o = {
    _id: 1,
    a: []
};
for (i = 0; i < 5; i++)
    o.a.push({x: i, y: i});

t.insert(o);

assert.eq(o, t.findOne(), "A");

t.update({}, {$pull: {a: {x: 3}}});
o.a = o.a.filter(function(z) {
    return z.x != 3;
});
assert.eq(o, t.findOne(), "B");

t.update({}, {$pull: {a: {x: {$in: [1, 4]}}}});
o.a = o.a.filter(function(z) {
    return z.x != 1;
});
o.a = o.a.filter(function(z) {
    return z.x != 4;
});
assert.eq(o, t.findOne(), "C");