summaryrefslogtreecommitdiff
path: root/jstests/core/explain_shell_helpers.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/core/explain_shell_helpers.js')
-rw-r--r--jstests/core/explain_shell_helpers.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/jstests/core/explain_shell_helpers.js b/jstests/core/explain_shell_helpers.js
index 3c05b760e71..b5f50437304 100644
--- a/jstests/core/explain_shell_helpers.js
+++ b/jstests/core/explain_shell_helpers.js
@@ -253,6 +253,14 @@ assert.commandWorked(explain);
assert(planHasStage(explain.queryPlanner.winningPlan, "COUNT"));
assert(planHasStage(explain.queryPlanner.winningPlan, "COUNT_SCAN"));
+// Explainable count with hint.
+assert.commandWorked(t.ensureIndex({c: 1}, {sparse: true}));
+explain = t.explain().count({c: {$exists: false}}, {hint: "c_1"});
+assert.commandWorked(explain);
+assert(planHasStage(explain.queryPlanner.winningPlan, "IXSCAN"));
+assert.eq(getPlanStage(explain.queryPlanner.winningPlan, "IXSCAN").indexName, "c_1");
+assert.commandWorked(t.dropIndex({c: 1}));
+
//
// .group()
//