Cannot specify a named index hint

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Minor - P4
    • 1.8.3
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • 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.

              Assignee:
              Steve Francia (Inactive)
              Reporter:
              Gustav Munkby
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: