summaryrefslogtreecommitdiff
path: root/jstests/core/index_stats.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/core/index_stats.js')
-rw-r--r--jstests/core/index_stats.js50
1 files changed, 28 insertions, 22 deletions
diff --git a/jstests/core/index_stats.js b/jstests/core/index_stats.js
index fc4aca2a77f..7db4559210c 100644
--- a/jstests/core/index_stats.js
+++ b/jstests/core/index_stats.js
@@ -78,10 +78,8 @@
//
// Confirm index stats tick on findAndModify() update.
//
- var res = db.runCommand({findAndModify: colName,
- query: {a: 1},
- update: {$set: {d: 1}},
- 'new': true});
+ var res = db.runCommand(
+ {findAndModify: colName, query: {a: 1}, update: {$set: {d: 1}}, 'new': true});
assert.commandWorked(res);
countA++;
assert.eq(countA, getUsageCount("a_1"));
@@ -89,9 +87,7 @@
//
// Confirm index stats tick on findAndModify() delete.
//
- res = db.runCommand({findAndModify: colName,
- query: {a: 2},
- remove: true});
+ res = db.runCommand({findAndModify: colName, query: {a: 2}, remove: true});
assert.commandWorked(res);
countA++;
assert.eq(countA, getUsageCount("a_1"));
@@ -112,8 +108,7 @@
var name = indexNameList[i];
if (name === "a_1") {
countA++;
- }
- else {
+ } else {
assert(name === "b_1_c_1");
countB++;
}
@@ -137,11 +132,15 @@
//
// Confirm index stats tick on group().
//
- res = db.runCommand({group: {ns: colName,
- key: {b: 1, c: 1},
- cond: {b: {$gt: 0}},
- $reduce: function(curr, result) {},
- initial: {}}});
+ res = db.runCommand({
+ group: {
+ ns: colName,
+ key: {b: 1, c: 1},
+ cond: {b: {$gt: 0}},
+ $reduce: function(curr, result) {},
+ initial: {}
+ }
+ });
assert.commandWorked(res);
countB++;
assert.eq(countB, getUsageCount("b_1_c_1"));
@@ -149,8 +148,7 @@
//
// Confirm index stats tick on aggregate w/ match.
//
- res = db.runCommand({aggregate: colName,
- pipeline: [{$match: {b: 1}}]});
+ res = db.runCommand({aggregate: colName, pipeline: [{$match: {b: 1}}]});
assert.commandWorked(res);
countB++;
assert.eq(countB, getUsageCount("b_1_c_1"));
@@ -158,11 +156,17 @@
//
// Confirm index stats tick on mapReduce with query.
//
- res = db.runCommand({mapReduce: colName,
- map: function() {emit(this.b, this.c);},
- reduce: function(key, val) {return val;},
- query: {b: 2},
- out: {inline: true}});
+ res = db.runCommand({
+ mapReduce: colName,
+ map: function() {
+ emit(this.b, this.c);
+ },
+ reduce: function(key, val) {
+ return val;
+ },
+ query: {b: 2},
+ out: {inline: true}
+ });
assert.commandWorked(res);
countB++;
assert.eq(countB, getUsageCount("b_1_c_1"));
@@ -206,5 +210,7 @@
//
// Confirm that retrieval fails if $indexStats is not in the first pipeline position.
//
- assert.throws(function() { col.aggregate([{$match: {}}, {$indexStats: {}}]); });
+ assert.throws(function() {
+ col.aggregate([{$match: {}}, {$indexStats: {}}]);
+ });
})();