[SERVER-8562] indexOnly should be false when sorting by a non indexed field Created: 13/Feb/13  Updated: 07/Mar/14  Resolved: 13/Feb/13

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: 2.4.0-rc0
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Sridhar Nanjundeswaran Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

2.4.0-rc0 on OS X


Issue Links:
Duplicate
duplicates SERVER-5759 indexOnly in explain() is not reporte... Closed
Operating System: ALL
Steps To Reproduce:

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]}

)
}
coll.insert
coll.ensureIndex(

{a:1,b:-1,c:1}

)
coll.ensureIndex(

{e:1}

)
coll.ensureIndex(

{d:1}

)
// Test sort on non-indexed field
var plan = coll.find({d:{$lt:1000}},

{d:1, _id:0}

).sort(

{c:1}

).hint(

{d:1}

).explain()
assert.eq(false, plan.indexOnly, "negative.1.6 - indexOnly should be false on a non covered query")

Participants:

 Description   

When sorting by a field that is not part of the index, indexOnly should be false irrespective of the fields projected.
The test below yields indexOnly=true



 Comments   
Comment by Aaron Staple [ 13/Feb/13 ]

I think this is covered by the "scan and order sort applied" item in SERVER-5759.

Generated at Thu Feb 08 03:17:46 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.