|
There is a small inconsistency between count with an index hint and a regular query with an index hint. A regular query with an empty find() that hints a non-existent index will report an error:
> db.test.find().hint('BAD HINT')
|
error: {
|
"$err" : "Unable to execute query: error processing query: ns=test.test limit=0 skip=0\nTree: $and\nSort: {}\nProj: {}\n planner returned error: bad hint",
|
"code" : 17007
|
}
|
while count does not:
> db.test.find().hint( "BAD HINT" ).count();
|
2
|
Though it does if query criteria is specified
> db.test.find( { i: 1 } ).hint( "BAD HINT" ).count();
|
2014-08-05T13:09:25.719-0400 count failed: {
|
"errmsg" : "exception: error processing query: ns=test.test limit=0 skip=0\nTree: i == 1.0\nSort: {}\nProj: {}\n planner returned error: bad hint",
|
"code" : 2,
|
"ok" : 0
|
} at src/mongo/shell/query.js:191
|
|