Files
mongo/jstests/core/write/update/update_arraymatch6.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

16 lines
341 B
JavaScript

var res;
let t = db.jstests_update_arraymatch6;
t.drop();
function doTest() {
t.save({a: [{id: 1, x: [5, 6, 7]}, {id: 2, x: [8, 9, 10]}]});
res = t.update({'a.id': 1}, {$set: {'a.$.x': [1, 1, 1]}});
assert.commandWorked(res);
assert.eq(1, t.findOne().a[0].x[0]);
}
doTest();
t.drop();
t.createIndex({'a.id': 1});
doTest();