Details
-
Bug
-
Resolution: Done
-
Critical - P2
-
None
-
1.8.0
-
None
-
ubuntu 10.04 64 bit
-
Linux
Description
> db.error_types.getIndexes()
[
{
"name" : "id",
"ns" : "prod_ec.error_types",
"key" :
},
{
"key" :
,
"ns" : "prod_ec.error_types",
"background" : true,
"name" : "app_id_1_digest_1"
},
{
"key" :
,
"ns" : "prod_ec.error_types",
"background" : true,
"name" : "app_id_1"
},
{
"key" :
,
"ns" : "prod_ec.error_types",
"background" : true,
"name" : "app_id_1_app_version_-1_is_resolved_1_updated_at_-1"
}
]
> db.error_types.find(
{ is_resolved: false, app_id: ObjectId('4d15ce1a9ea1a313dd017dba')}).sort(
{ updated_at: -1 })
error:
but if I run the query with explain, BtreeCursor does used. (but it seems that mongodb picked the wrong one)
> db.error_types.find(
{ is_resolved: false, app_id: ObjectId('4d15ce1a9ea1a313dd017dba')}).sort(
{ updated_at: -1 }).explain()
{
"cursor" : "BtreeCursor app_id_1_digest_1",
"nscanned" : 82,
"nscannedObjects" : 82,
"n" : 82,
"scanAndOrder" : true,
"millis" : 52,
"indexBounds" : {
"app_id" : [
[
ObjectId("4d15ce1a9ea1a313dd017dba"),
ObjectId("4d15ce1a9ea1a313dd017dba")
]
],
"digest" : [
[
,
{ "$maxElement" : 1 } ]
]
}
}
I added hint to the query, but still the same error
>db.error_types.find(
{ is_resolved: false, app_id: ObjectId('4d15ce1a9ea1a313dd017dba')}).sort(
{ updated_at: -1 }).hint("app_id_1_app_version_-1_is_resolved_1_updated_at_-1")
error:
> db.error_types.find(
{ is_resolved: false, app_id: ObjectId('4d15ce1a3ea7a313dd017dba')}).sort(
{ updated_at: -1 }).hint("app_id_1_app_version_-1_is_resolved_1_updated_at_-1")
error:
<4d15ce1a9ea1a313dd017dba')}).sort(
{ updated_at: -1 }).hint("app_id_1_app_version_-1_is_resolved_1_updated_at_-1").explain()
{
"cursor" : "BtreeCursor app_id_1_app_version_-1_is_resolved_1_updated_at_-1",
"nscanned" : 0,
"nscannedObjects" : 0,
"n" : 0,
"scanAndOrder" : true,
"millis" : 0,
"indexBounds" : {
"app_id" : [
[
ObjectId("4d15ce1a9ea1a313dd017dba"),
ObjectId("4d15ce1a9ea1a313dd017dba")
]
],
"app_version" : [
[
,
{ "$minElement" : 1 } ]
],
"is_resolved" : [
[
false,
false
]
],
"updated_at" : [
[
"$maxElement" : 1
},
]
]
}
}