Files
mongo/jstests/core/query/array/array_match1.js
Steve McClure 1ffbc6c2e9 SERVER-109432: Autofix JS var usage to favor let (#40637)
GitOrigin-RevId: 9674b7db36a0f3f650d39c1e3fb2ad6ff2141cfb
2025-08-28 19:21:01 +00:00

35 lines
582 B
JavaScript

// @tags: [
// requires_getmore
// ]
let t = db.array_match1;
t.drop();
t.insert({_id: 1, a: [5, 5]});
t.insert({_id: 2, a: [6, 6]});
t.insert({_id: 3, a: [5, 5]});
function test(f, m) {
let q = {};
q[f] = [5, 5];
assert.eq(2, t.find(q).itcount(), m + "1");
q[f] = [6, 6];
assert.eq(1, t.find(q).itcount(), m + "2");
}
test("a", "A");
t.createIndex({a: 1});
test("a", "B");
t.drop();
t.insert({_id: 1, a: {b: [5, 5]}});
t.insert({_id: 2, a: {b: [6, 6]}});
t.insert({_id: 3, a: {b: [5, 5]}});
test("a.b", "C");
t.createIndex({a: 1});
test("a.b", "D");