Files
mongo/jstests/core/query/update/update_arraymatch7.js
Joshua Siegel 169f8dc283 SERVER-111817 Add tag to exclude tests from timeseries CRUD suite (#44113)
GitOrigin-RevId: a3ab3b89275fa89c9824f6af467d56d605096159
2025-11-21 18:08:16 +00:00

26 lines
800 B
JavaScript

// @tags: [
// requires_non_retryable_writes,
// # Time series collections do not support indexing array values in measurement fields.
// exclude_from_timeseries_crud_passthrough,
// ]
// Check that the positional operator works properly when an index only match is used for the update
// query spec. SERVER-5067
const t = db[jsTestName()];
t.drop();
function testPositionalInc() {
assert.commandWorked(t.remove({}));
assert.commandWorked(t.save({a: [{b: "match", count: 0}]}));
assert.commandWorked(t.update({"a.b": "match"}, {$inc: {"a.$.count": 1}}));
// Check that the positional $inc succeeded.
assert(t.findOne({"a.count": 1}));
}
testPositionalInc();
// Now check with a non multikey index.
assert.commandWorked(t.createIndex({"a.b": 1}));
testPositionalInc();