Files
mongo/jstests/core/query/regex/regexa.js
Zac 591928c619 SERVER-108478 JS formatted by prettier and remove clang-format (#39656)
GitOrigin-RevId: 6c8f6aded47f260aa4f7c231b17dae3302cb1e04
2025-08-21 17:27:09 +00:00

21 lines
398 B
JavaScript

// Test simple regex optimization with a regex | (bar) present - SERVER-3298
let t = db.jstests_regexa;
t.drop();
function check() {
assert.eq(1, t.count({a: /^(z|.)/}));
assert.eq(1, t.count({a: /^z|./}));
assert.eq(0, t.count({a: /^z(z|.)/}));
assert.eq(1, t.count({a: /^zz|./}));
}
t.save({a: "a"});
check();
t.createIndex({a: 1});
if (1) {
// SERVER-3298
check();
}