diff options
Diffstat (limited to 'jstests/core/covered_index_negative_1.js')
-rw-r--r-- | jstests/core/covered_index_negative_1.js | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/jstests/core/covered_index_negative_1.js b/jstests/core/covered_index_negative_1.js index b2ab81b37cc..8afd03f2a58 100644 --- a/jstests/core/covered_index_negative_1.js +++ b/jstests/core/covered_index_negative_1.js @@ -6,46 +6,46 @@ // Include helpers for analyzing explain output. load("jstests/libs/analyze_plan.js"); -var coll = db.getCollection("covered_negative_1") -coll.drop() +var coll = db.getCollection("covered_negative_1"); +coll.drop(); for (i=0;i<100;i++) { coll.insert({a:i, b:"strvar_"+(i%13), c:NumberInt(i%10), d: i*10, e: [i, i%10], - f:i}) + f:i}); } -coll.ensureIndex({a:1,b:-1,c:1}) -coll.ensureIndex({e:1}) -coll.ensureIndex({d:1}) -coll.ensureIndex({f:"hashed"}) +coll.ensureIndex({a:1,b:-1,c:1}); +coll.ensureIndex({e:1}); +coll.ensureIndex({d:1}); +coll.ensureIndex({f:"hashed"}); // Test no projection var plan = coll.find({a:10, b:"strvar_10", c:0}).hint({a:1, b:-1, c:1}).explain("executionStats"); assert(!isIndexOnly(plan.queryPlanner.winningPlan), - "negative.1.1 - indexOnly should be false on a non covered query") + "negative.1.1 - indexOnly should be false on a non covered query"); assert.neq(0, plan.executionStats.totalDocsExamined, - "negative.1.1 - docs examined should not be 0 for a non covered query") + "negative.1.1 - docs examined should not be 0 for a non covered query"); // Test projection and not excluding _id var plan = coll.find({a:10, b:"strvar_10", c:0},{a:1, b:1, c:1}) .hint({a:1, b:-1, c:1}) .explain("executionStats"); assert(!isIndexOnly(plan.queryPlanner.winningPlan), - "negative.1.2 - indexOnly should be false on a non covered query") + "negative.1.2 - indexOnly should be false on a non covered query"); assert.neq(0, plan.executionStats.totalDocsExamined, - "negative.1.2 - docs examined should not be 0 for a non covered query") + "negative.1.2 - docs examined should not be 0 for a non covered query"); // Test projection of non-indexed field var plan = coll.find({d:100},{d:1, c:1, _id:0}).hint({d:1}).explain("executionStats"); assert(!isIndexOnly(plan.queryPlanner.winningPlan), - "negative.1.3 - indexOnly should be false on a non covered query") + "negative.1.3 - indexOnly should be false on a non covered query"); assert.neq(0, plan.executionStats.totalDocsExamined, - "negative.1.3 - docs examined should not be 0 for a non covered query") + "negative.1.3 - docs examined should not be 0 for a non covered query"); // Test query and projection on a multi-key index var plan = coll.find({e:99},{e:1, _id:0}).hint({e:1}).explain("executionStats"); assert(!isIndexOnly(plan.queryPlanner.winningPlan), - "negative.1.4 - indexOnly should be false on a non covered query") + "negative.1.4 - indexOnly should be false on a non covered query"); assert.neq(0, plan.executionStats.totalDocsExamined, - "negative.1.4 - docs examined should not be 0 for a non covered query") + "negative.1.4 - docs examined should not be 0 for a non covered query"); // Commenting out negative.1.5 and 1.6 pending fix in SERVER-8650 // // Test projection and $natural sort @@ -65,15 +65,15 @@ var plan = coll.find({d:{$lt:1000}},{a:1, b:1, c:1, _id:0}) .hint({a:1, b:-1, c:1}) .explain("executionStats"); assert(!isIndexOnly(plan.queryPlanner.winningPlan), - "negative.1.7 - indexOnly should be false on a non covered query") + "negative.1.7 - indexOnly should be false on a non covered query"); assert.neq(0, plan.executionStats.totalDocsExamined, - "negative.1.7 - docs examined should not be 0 for a non covered query") + "negative.1.7 - docs examined should not be 0 for a non covered query"); // Test query on hashed indexed field var plan = coll.find({f:10},{f:1, _id:0}).hint({f:"hashed"}).explain("executionStats"); assert(!isIndexOnly(plan.queryPlanner.winningPlan), - "negative.1.8 - indexOnly should be false on a non covered query") + "negative.1.8 - indexOnly should be false on a non covered query"); assert.neq(0, plan.executionStats.totalDocsExamined, - "negative.1.8 - nscannedObjects should not be 0 for a non covered query") + "negative.1.8 - nscannedObjects should not be 0 for a non covered query"); -print('all tests passed') +print('all tests passed'); |