blob: 62375da7aabe267cbe018c832296b223068043bc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
// @tags: [
// # 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.
// assumes_unsharded_collection,
//
// # Uses $where operator
// requires_scripting,
// ]
t = db.find_and_modify_where;
t.drop();
t.insert({_id: 1, x: 1});
res = t.findAndModify({query: {$where: "return this.x == 1"}, update: {$set: {y: 1}}});
assert.eq(1, t.findOne().y);
|