summaryrefslogtreecommitdiff
path: root/jstests/core/update2.js
blob: 558e3c7f5584c83863af0f4ffdef050c52cab77f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// 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]

f = db.ed_db_update2;

f.drop();
f.save({a: 4});
f.update({a: 4}, {$inc: {a: 2}});
assert.eq(6, f.findOne().a);

f.drop();
f.save({a: 4});
f.ensureIndex({a: 1});
f.update({a: 4}, {$inc: {a: 2}});
assert.eq(6, f.findOne().a);

// Verify that drop clears the index
f.drop();
f.save({a: 4});
f.update({a: 4}, {$inc: {a: 2}});
assert.eq(6, f.findOne().a);