[SERVER-468] explain() broken for _id queries Created: 09/Dec/09  Updated: 12/Jul/16  Resolved: 12/Mar/10

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: 1.1.4, 1.2.0, 1.3.0
Fix Version/s: 1.3.4

Type: Bug Priority: Major - P3
Reporter: Mathias Stearn Assignee: Eliot Horowitz (Inactive)
Resolution: Done Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

> db.foo.find()

{ "_id" : ObjectId("4b1fd7257a88ded6296525ba"), "k" : 3 }

> db.foo.find(

{ "_id" : ObjectId("4b1fd7257a88ded6296525ba")}

)

{ "_id" : ObjectId("4b1fd7257a88ded6296525ba"), "k" : 3 }

> db.foo.find(

{ "_id" : ObjectId("4b1fd7257a88ded6296525ba")}

).explain()

{ "_id" : ObjectId("4b1fd7257a88ded6296525ba"), "k" : 3 }

 Comments   
Comment by Eliot Horowitz (Inactive) [ 12/Mar/10 ]

note, you can't do { query : {} }.explain() but

{ _id : xxx }

.explain() is now working

Comment by auto [ 12/Mar/10 ]

Author:

{'login': 'erh', 'name': 'Eliot Horowitz', 'email': 'eliot@10gen.com'}

Message: fix explain for _id lookup SERVER-468
http://github.com/mongodb/mongo/commit/43b2fab5cdcb6f935c68215e81e7977841efb624

Comment by Mathias Stearn [ 09/Dec/09 ]

> db.foo.find({query:{ "_id" : ObjectId("4b1fd7257a88ded6296525ba")}})

{ "_id" : ObjectId("4b1fd7257a88ded6296525ba"), "k" : 3 }

> db.foo.find({query:{ "_id" : ObjectId("4b1fd7257a88ded6296525ba")}}).explain()
{
"cursor" : "BasicCursor",
"startKey" : {

},
"endKey" : {

},
"nscanned" : 1,
"n" : 0,
"millis" : 0,
"allPlans" : [
{
"cursor" : "BasicCursor",
"startKey" : {

},
"endKey" : {

}
}
]
}

Generated at Thu Feb 08 02:54:13 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.