-
Type: Bug
-
Resolution: Done
-
Priority: Minor - P4
-
Affects Version/s: None
-
Component/s: None
-
None
The mongo client allows specifying an index by name:
db.foo.find()._addSpecial("$hint", "index_name")
However, when issuing the "corresponding"
foo.find({}, :hint => 'index_name')
Then 'index_name' is interpreted as a field name, resulting in the javascript equivalent:
db.foo.find()._addSpecial("$hint",
{index_name: 1})
While that might be a sensible default, there ought to be a way to specify an index hint by name.
As the current behavior is documented, changing the semantics of :hint would definitely be a breaking change, but a workaround would be to add a separate option :named_hint or something along those lines.