-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Fully Compatible
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.