make readable methods recognize chained options

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Minor - P4
    • 2.18.0
    • Affects Version/s: 2.14.0
    • Component/s: None
    • None
    • None
    • Fully Compatible
    • None
    • None
    • None
    • None
    • None
    • None

      Queries of the form `MyCollection.where(...).hint(...).count` run an aggregation pipeline to determine the size without passing on the index hint. In cases where the query is sufficiently complicated the server will use the wrong index and the query times out. 

      I tracked down the issue to `Mongo::Collection::View::Readable#count_documents` where the aggregation pipeline `opts` do not include the view's `options[:hint]`. Adding `opts[:hint] = options[:hint]` before the aggregation pipeline runs seems to resolve the issue.

      I'm not sure why all of the view options are not currently used for `count_documents`, but it certainly seems like a bug to not respect the index hint provided. 

       

       

            Assignee:
            Neil Shweky (Inactive)
            Reporter:
            Daniel Peters
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: