2
我創造了周圍的幾個項目的索引用於特定查詢我做:蒙戈指數不使用
{
"v" : 1,
"key" : {
"MODIFIED" : -1,
"state" : 1,
"fail" : 1,
"generated" : 1
},
"ns" : "foo.bar",
"name" : "MODIFIED_-1_state_1_fail_1_generated"
}
然而,當我執行我的查詢,它不使用apear我的索引是。你能不能提供一些我做錯的事情?
謝謝!
db.foo.find( {
"$or": [
{
"MODIFIED": {
"$gt": {
"sec": 1321419600,
"usec": 0
}
}
},
{
"$or": [
{"state": "ca"},
{"state": "ok"}
]
}
],
"$and": [
{"fail": {"$ne": 1}},
{"generated": {"$exists": false}}
]
}).explain();
{
"cursor" : "BasicCursor",
"nscanned" : 464215,
"nscannedObjects" : 464215,
"n" : 0,
"millis" : 7549,
"nYields" : 0,
"nChunkSkips" : 0,
"isMultiKey" : false,
"indexOnly" : false,
"indexBounds" : {
}
}
謝謝你的優秀答案;以及一點教育! – Petrogad 2012-02-14 19:35:22
調整,一切都很好;快多了。再次感謝你的幫助! – Petrogad 2012-02-14 19:59:27
不客氣;) – 2012-02-15 09:10:45