-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Querying
-
None
-
Fully Compatible
-
Windows
We're having an issue where a FindAndModify in our code, in some of our environments/servers, decides to use an index that fails horribly (i.e. is sparse, when we're querying for nulls), and would like a way to force it to use a correct index. We're open to using an Update instead, if it would mean a faster turn-around on this issue.
Our current example:
SECONDARY> db.version()
2.0.3
SECONDARY> db.ourcollection.getIndexes()
[
{
"v" : 1,
"key" :
,
"ns" : "ourdb.ourcollection",
"name" : "id"
},
{
"v" : 1,
"key" :
,
"ns" : "ourdb.ourcollection",
"name" : "StartedOn_-1",
"background" : true,
"sparse" : true
}
]
SECONDARY> db.ourcollection.find(
{ "_id" : new BinData(3,"L9UXPwbYdEiSQ68DG7A1iQ=="), "StartedOn" : null }).explain()
{
"cursor" : "BtreeCursor StartedOn_-1",
"nscanned" : 30,
"nscannedObjects" : 30,
"n" : 0,
"millis" : 0,
"nYields" : 0,
"nChunkSkips" : 0,
"isMultiKey" : false,
"indexOnly" : false,
"indexBounds" :
}
SECONDARY> db.ourcollection.find(
{ "_id" : new BinData(3,"L9UXPwbYdEiSQ68DG7A1iQ==") },
{ _id: 1, StartedOn: 1 }).toArray()
[
]
SECONDARY> db.ourcollection.find(
{ "_id" : new BinData(3,"L9UXPwbYdEiSQ68DG7A1iQ=="), "StartedOn" : null }).toArray()
[ ]
- is related to
-
SERVER-1599 support ability to pass hint to update
- Closed
- related to
-
SERVER-2677 Allow count to work with query hints
- Closed