setting readPreference via the uri string doesn't work

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Gone away
    • Priority: Major - P3
    • None
    • Affects Version/s: 2.2.33
    • Component/s: None
    • Environment:
      Linux
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      I have an replica-set: mong1(primary), mongo2(secondary) and mongo3(secondary)

      The uri used for connection is:

      mongodb://mongo1,mongo2,mongo3/some_collection?replicaSet=XXX&readPreference=secondary'

      However, all read operation were still performed on the primary mongo host(mongo1).
      This issue can be solved by change the order of the hosts in uri, the uri below will work fine

      mongodb://mongo2,mongo1,mongo3/some_collection?replicaSet=XXX&readPreference=secondary'
      

      I'm not sure why the order of the mongo hosts in the uri matters in this case. if this is an bug please let me kniw

            Assignee:
            Katherine Walker (Inactive)
            Reporter:
            kelun zhang
            None
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: