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

Collection read preference not passed to find command

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • 2.10.0.rc0
    • None
    • None
    • Fully Compatible

    Description

      A read preference set with #with does not appear to be passed to the find command:

      irb(main):006:0> c=a['test']
      => #<Mongo::Collection:0x47405477702640 namespace=admin.test>
      irb(main):007:0> c.read_preference
      => {"mode"=>:secondary}
      irb(main):008:0> d=c.with(read:{mode: :primary})
      => #<Mongo::Collection:0x47405477816800 namespace=admin.test>
      irb(main):009:0> d.read_preference
      => {:mode=>:primary}
      irb(main):010:0> d.find.to_a.count
      ...
      D, [2019-06-24T18:00:36.726737 #21320] DEBUG -- : MONGODB | localhost:27741 | admin.find | STARTED | {"find"=>"test", "filter"=>{}, "$readPreference"=>{"mode"=>"secondary"}, "lsid"=>{"id"=><BSON::Binary:0x47405477895640 type=uuid data=0x67aab09b8aa14b73...>}}
      

      Note that the find command still had a secondary read preference even though I verified that the collection's read preference is primary.

      Attachments

        Issue Links

          Activity

            People

              oleg.pudeyev@mongodb.com Oleg Pudeyev
              oleg.pudeyev@mongodb.com Oleg Pudeyev
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: