summaryrefslogtreecommitdiff
path: root/jstests/core/explain_count.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/core/explain_count.js')
-rw-r--r--jstests/core/explain_count.js34
1 files changed, 16 insertions, 18 deletions
diff --git a/jstests/core/explain_count.js b/jstests/core/explain_count.js
index 6e42657fd3b..4943c511252 100644
--- a/jstests/core/explain_count.js
+++ b/jstests/core/explain_count.js
@@ -20,8 +20,7 @@ function checkCountExplain(explain, nCounted) {
var countStage = execStages.shards[0].executionStages;
assert.eq(countStage.stage, "COUNT", "root stage on shard is not COUNT");
assert.eq(countStage.nCounted, nCounted, "wrong count result");
- }
- else {
+ } else {
assert.eq(execStages.stage, "COUNT", "root stage is not COUNT");
assert.eq(execStages.nCounted, nCounted, "wrong count result");
}
@@ -46,13 +45,13 @@ explain = db.runCommand({explain: {count: collName, limit: -3}, verbosity: "exec
checkCountExplain(explain, 0);
assert.eq(0, db.runCommand({count: collName, limit: -3, skip: 4}).n);
-explain = db.runCommand({explain: {count: collName, limit: -3, skip: 4},
- verbosity: "executionStats"});
+explain =
+ db.runCommand({explain: {count: collName, limit: -3, skip: 4}, verbosity: "executionStats"});
checkCountExplain(explain, 0);
assert.eq(0, db.runCommand({count: collName, query: {a: 1}, limit: -3, skip: 4}).n);
-explain = db.runCommand({explain: {count: collName, query: {a: 1}, limit: -3, skip: 4},
- verbosity: "executionStats"});
+explain = db.runCommand(
+ {explain: {count: collName, query: {a: 1}, limit: -3, skip: 4}, verbosity: "executionStats"});
checkCountExplain(explain, 0);
// Now add a bit of data to the collection.
@@ -83,26 +82,25 @@ checkCountExplain(explain, 3);
// Trivial count with both limit and skip.
assert.eq(3, db.runCommand({count: collName, limit: -3, skip: 4}).n);
-explain = db.runCommand({explain: {count: collName, limit: -3, skip: 4},
- verbosity: "executionStats"});
+explain =
+ db.runCommand({explain: {count: collName, limit: -3, skip: 4}, verbosity: "executionStats"});
checkCountExplain(explain, 3);
// With a query.
assert.eq(10, db.runCommand({count: collName, query: {a: 1}}).n);
-explain = db.runCommand({explain: {count: collName, query: {a: 1}},
- verbosity: "executionStats"});
+explain = db.runCommand({explain: {count: collName, query: {a: 1}}, verbosity: "executionStats"});
checkCountExplain(explain, 10);
// With a query and skip.
assert.eq(7, db.runCommand({count: collName, query: {a: 1}, skip: 3}).n);
-explain = db.runCommand({explain: {count: collName, query: {a: 1}, skip: 3},
- verbosity: "executionStats"});
+explain = db.runCommand(
+ {explain: {count: collName, query: {a: 1}, skip: 3}, verbosity: "executionStats"});
checkCountExplain(explain, 7);
// With a query and limit.
assert.eq(3, db.runCommand({count: collName, query: {a: 1}, limit: 3}).n);
-explain = db.runCommand({explain: {count: collName, query: {a: 1}, limit: 3},
- verbosity: "executionStats"});
+explain = db.runCommand(
+ {explain: {count: collName, query: {a: 1}, limit: 3}, verbosity: "executionStats"});
checkCountExplain(explain, 3);
// Insert one more doc for the last few tests.
@@ -110,12 +108,12 @@ t.insert({a: 2});
// Case where all results are skipped.
assert.eq(0, db.runCommand({count: collName, query: {a: 2}, skip: 2}).n);
-explain = db.runCommand({explain: {count: collName, query: {a: 2}, skip: 2},
- verbosity: "executionStats"});
+explain = db.runCommand(
+ {explain: {count: collName, query: {a: 2}, skip: 2}, verbosity: "executionStats"});
checkCountExplain(explain, 0);
// Case where we have a limit, but we don't hit it.
assert.eq(1, db.runCommand({count: collName, query: {a: 2}, limit: 2}).n);
-explain = db.runCommand({explain: {count: collName, query: {a: 2}, limit: 2},
- verbosity: "executionStats"});
+explain = db.runCommand(
+ {explain: {count: collName, query: {a: 2}, limit: 2}, verbosity: "executionStats"});
checkCountExplain(explain, 1);