Files
mongo/jstests/core/query/count/countb.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

16 lines
537 B
JavaScript

// Test fast count mode with single key index unsatisfiable constraints on a multi key index.
// @tags: [
// # Uses $where operator
// requires_scripting,
// ]
let t = db.jstests_countb;
t.drop();
t.createIndex({a: 1});
t.save({a: ["a", "b"]});
assert.eq(0, t.find({a: {$in: ["a"], $gt: "b"}}).count());
assert.eq(0, t.find({$and: [{a: "a"}, {a: {$gt: "b"}}]}).count());
assert.eq(1, t.find({$and: [{a: "a"}, {$where: "this.a[1]=='b'"}]}).count());
assert.eq(0, t.find({$and: [{a: "a"}, {$where: "this.a[1]!='b'"}]}).count());