-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: 1.3
-
Component/s: None
-
Labels:
-
Empty show more show less
collection.ensureIndex(
{activated_at: -1, loc:'2dsphere'},
{name:'active_geo'}, function(err, ind){
collection.hint = function()
collection.find(
{ loc: { '$geoWithin':
} },
,
{ hint: 'active_geo' }).sort(
{activated_at:-1}).explain(function(err, doc)
{ if (err) console.log(err) console.log(doc) db.close(); process.exit() })
})
The problem is it doesnt respect the hint at all. I see the index is created but it's not used because of this:
- lib/mongodb/cursor.js line 552
if(self.hint != null && self.hint.constructor == Object) specialSelector['$hint'] = self.hint;
Why "self.hint.constructor == Object"
If i remove " && self.hint.constructor == Object" it works as expected and my hint 'active_geo' is used instead of the default 'GeoBrowse-box'