summaryrefslogtreecommitdiff
path: root/jstests/core/query/count/countb.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/core/query/count/countb.js')
-rw-r--r--jstests/core/query/count/countb.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/jstests/core/query/count/countb.js b/jstests/core/query/count/countb.js
new file mode 100644
index 00000000000..869825b25a1
--- /dev/null
+++ b/jstests/core/query/count/countb.js
@@ -0,0 +1,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());