Documentation for read option of Collection#find is incorrect

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Minor - P4
    • 2.5.0
    • Affects Version/s: 2.4.3
    • Component/s: Public API
    • None
    • Environment:
      MRI 2.3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      The rdoc for Collection#find has

      @option opts [:primary, :secondary] :read The default read preference for queries
          #   initiates from this connection object. If +:secondary+ is chosen, reads will be sent
          #   to one of the closest available secondary nodes. If a secondary node cannot be located, the
          #   read will be sent to the primary. If this option is left unspecified, the value of the read
          #   preference for this Collection object will be used.
      
      

      However the code seems to expect that a server selector is passed, as snippets like

      database['some_collection'].find({},{read: {mode: :secondary}}).first
      

      raises the following error

      NoMethodError: undefined method `select_server' for {"mode"=>:secondary}:BSON::Document
      

              Assignee:
              Emily Stolfo (Inactive)
              Reporter:
              Frederick Cheung
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: