summaryrefslogtreecommitdiff
path: root/jstests/core/query/inc/inc3.js
blob: 51a9c9c1587ee168b031d2630a7e84b082bf08fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// 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]

let t = db.inc3;

t.drop();
t.save({_id: 1, z: 1, a: 1});
t.update({}, {$inc: {z: 1, a: 1}});
t.update({}, {$inc: {a: 1, z: 1}});
assert.eq({_id: 1, z: 3, a: 3}, t.findOne(), "A");

t.drop();
t.save({_id: 1, a: 1, z: 1});
t.update({}, {$inc: {z: 1, a: 1}});
t.update({}, {$inc: {a: 1, z: 1}});
assert.eq({_id: 1, a: 3, z: 3}, t.findOne(), "B");