blob: 197c892ca67c5ba314a37592184aac5901663b37 (
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
|
// 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.find_and_modify_sever6588;
initial = {
_id: 1,
a: [{b: 1}],
z: 1
};
up = {
"$set": {"a.$.b": 2}
};
q = {
_id: 1,
"a.b": 1
};
correct = {
_id: 1,
a: [{b: 2}],
z: 1
};
t.drop();
t.insert(initial);
t.update(q, up);
assert.eq(correct, t.findOne());
t.drop();
t.insert(initial);
x = t.findAndModify({query: q, update: up});
assert.eq(correct, t.findOne());
t.drop();
t.insert(initial);
x = t.findAndModify({query: {z: 1, "a.b": 1}, update: up});
assert.eq(correct, t.findOne());
|