Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-493

Cannot specify a named index hint

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.8.3
    • 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.

            Assignee:
            spf13 Steve Francia
            Reporter:
            grddev Gustav Munkby
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: