summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/index_partial_no_explain_cmds.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/noPassthrough/index_partial_no_explain_cmds.js')
-rw-r--r--jstests/noPassthrough/index_partial_no_explain_cmds.js24
1 files changed, 17 insertions, 7 deletions
diff --git a/jstests/noPassthrough/index_partial_no_explain_cmds.js b/jstests/noPassthrough/index_partial_no_explain_cmds.js
index 10cdaf932d1..69af783c1a9 100644
--- a/jstests/noPassthrough/index_partial_no_explain_cmds.js
+++ b/jstests/noPassthrough/index_partial_no_explain_cmds.js
@@ -10,18 +10,24 @@
assert.commandWorked(coll.ensureIndex({x: 1}, {partialFilterExpression: {a: 1}}));
- assert.writeOK(coll.insert({_id: 1, x: 5, a: 2})); // Not in index.
- assert.writeOK(coll.insert({_id: 2, x: 6, a: 1})); // In index.
+ assert.writeOK(coll.insert({_id: 1, x: 5, a: 2})); // Not in index.
+ assert.writeOK(coll.insert({_id: 2, x: 6, a: 1})); // In index.
// Verify we will throw if the partial index can't be used.
- assert.throws(function() { coll.find({x: {$gt: 1}, a: 2}).itcount(); });
+ assert.throws(function() {
+ coll.find({x: {$gt: 1}, a: 2}).itcount();
+ });
//
// Test mapReduce.
//
- var mapFunc = function() { emit(this._id, 1); };
- var reduceFunc = function (keyId, countArray) { return Array.sum(countArray); };
+ var mapFunc = function() {
+ emit(this._id, 1);
+ };
+ var reduceFunc = function(keyId, countArray) {
+ return Array.sum(countArray);
+ };
ret = coll.mapReduce(mapFunc, reduceFunc, {out: "inline", query: {x: {$gt: 1}, a: 1}});
assert.eq(1, ret.counts.input);
@@ -34,8 +40,12 @@
assert.eq(1, ret.length);
ret = coll.distinct("x", {x: {$gt: 1}, a: 1});
assert.eq(1, ret.length);
- assert.throws(function() { printjson(coll.distinct("a", {a: 0})); });
- assert.throws(function() { printjson(coll.distinct("x", {a: 0})); });
+ assert.throws(function() {
+ printjson(coll.distinct("a", {a: 0}));
+ });
+ assert.throws(function() {
+ printjson(coll.distinct("x", {a: 0}));
+ });
// SERVER-19511 regression test: distinct with no query predicate should return the correct
// number of results. This query should not be allowed to use the partial index, so it should