Files
mongo/jstests/core/query/pull/pullall2.js
Jason Zhang 28eb8d299b SERVER-80780 Merge writes without shard key jscore passthrough with existing passthrough suites (#20175)
GitOrigin-RevId: a54cc3a3df44359ea51533f062642ee841f71460
2024-04-08 02:28:42 +00:00

26 lines
478 B
JavaScript

let t = db.pullall2;
t.drop();
let o = {_id: 1, a: []};
for (let i = 0; i < 5; i++)
o.a.push({x: i, y: i});
t.insert(o);
assert.eq(o, t.findOne(), "A");
t.update({}, {$pull: {a: {x: 3}}});
o.a = o.a.filter(function(z) {
return z.x != 3;
});
assert.eq(o, t.findOne(), "B");
t.update({}, {$pull: {a: {x: {$in: [1, 4]}}}});
o.a = o.a.filter(function(z) {
return z.x != 1;
});
o.a = o.a.filter(function(z) {
return z.x != 4;
});
assert.eq(o, t.findOne(), "C");