diff options
author | David Storch <david.storch@10gen.com> | 2014-12-30 16:12:47 -0500 |
---|---|---|
committer | David Storch <david.storch@10gen.com> | 2014-12-30 17:14:42 -0500 |
commit | 55871360dad240de351600b3cab67f9fd07994bc (patch) | |
tree | a2705a4f2a4b0445b8f6d420efa91e2d0c32d919 /jstests | |
parent | 20af9c79622fba6e53df9b2e6c7e00c6c85a79b5 (diff) | |
download | mongo-55871360dad240de351600b3cab67f9fd07994bc.tar.gz |
SERVER-16577 add queryPlanner.indexFilterSet field to new explain format
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/core/index_filter_commands.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/jstests/core/index_filter_commands.js b/jstests/core/index_filter_commands.js index dddc69a688d..048e1cd8178 100644 --- a/jstests/core/index_filter_commands.js +++ b/jstests/core/index_filter_commands.js @@ -145,3 +145,30 @@ assert(!planCacheContains(shape), 'plan cache for query shape not flushed after print('Plan details before setting filter = ' + tojson(planBeforeSetFilter.details, '', true)); print('Plan details after setting filter = ' + tojson(planAfterSetFilter.details, '', true)); + +// +// Tests for the 'indexFilterSet' explain field. +// + +// No filter. +t.getPlanCache().clear(); +assert.eq(false, t.find({z: 1}).explain('queryPlanner').queryPlanner.indexFilterSet); +assert.eq(false, t.find(queryA1, projectionA1).sort(sortA1) + .explain('queryPlanner').queryPlanner.indexFilterSet); + +// With one filter set. +assert.commandWorked(t.runCommand('planCacheSetFilter', {query: {z: 1}, indexes: [{z: 1}]})); +assert.eq(true, t.find({z: 1}).explain('queryPlanner').queryPlanner.indexFilterSet); +assert.eq(false, t.find(queryA1, projectionA1).sort(sortA1) + .explain('queryPlanner').queryPlanner.indexFilterSet); + +// With two filters set. +assert.commandWorked(t.runCommand('planCacheSetFilter', { + query: queryA1, + projection: projectionA1, + sort: sortA1, + indexes: [indexA1B1, indexA1C1] +})); +assert.eq(true, t.find({z: 1}).explain('queryPlanner').queryPlanner.indexFilterSet); +assert.eq(true, t.find(queryA1, projectionA1).sort(sortA1) + .explain('queryPlanner').queryPlanner.indexFilterSet); |