[SERVER-8560] Covered query on a compound index that does not yield any results does not have indexOnly = true Created: 13/Feb/13  Updated: 15/Feb/13  Resolved: 13/Feb/13

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

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

2.4.0-rc0 on OS X


Operating System: ALL
Steps To Reproduce:

var coll = db.getCollection("covered_compound_1")
coll.drop()
for (i=0;i<100;i++) {
coll.insert(

{a:i, b:"strvar_"+(i%13), c:NumberInt(i%10)}

)
}
coll.insert
coll.ensureIndex(

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

)
// Test no result
var plan = coll.find(

{a:38, b:"strvar_12", c:55}

).hint(

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

).explain()
assert.eq(true, plan.indexOnly, "compound.1.7 - indexOnly should be true on covered query")

Participants:

 Description   

Covered index query which does not return a result does not have indexOnly=true



 Comments   
Comment by Sridhar Nanjundeswaran [ 13/Feb/13 ]

Resolving this ticket. Adding the projection sets the flag correctly

Comment by Aaron Staple [ 13/Feb/13 ]

I think you need a projection spec here that excludes _id.

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