summaryrefslogtreecommitdiff
path: root/jstests/core/countb.js
blob: 869825b25a1c2548d75dcba7e482301abe67c4f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// Test fast count mode with single key index unsatisfiable constraints on a multi key index.
// @tags: [
//     # Uses $where operator
//     requires_scripting,
// ]

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());