Files
mongo/jstests/core/query/pull/pull_remove1.js
2023-05-07 16:55:23 +00:00

20 lines
494 B
JavaScript

// 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.pull_remove1;
t.drop();
let o = {_id: 1, a: [1, 2, 3, 4, 5, 6, 7, 8]};
t.insert(o);
assert.eq(o, t.findOne(), "A1");
o.a = o.a.filter(function(z) {
return z >= 6;
});
t.update({}, {$pull: {a: {$lt: 6}}});
assert.eq(o.a, t.findOne().a, "A2");