Mongos sharded replicaset read preference is not honored

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • 1.4
    • Affects Version/s: 3.0.0
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      ReplSet: https://github.com/mongodb/node-mongodb-native/blob/1.4/lib/mongodb/connection/repl_set/repl_set.js#L161

      vs

      Server: https://github.com/mongodb/node-mongodb-native/blob/1.4/lib/mongodb/connection/server.js#L164

      Which is used in: https://github.com/mongodb/node-mongodb-native/blob/1.4/lib/mongodb/db.js#L262

      This causes readPreference variable to be missed out in the connect_options.

      I don't know if this is intended or not, but after adding: this.options.readPreference = this._readPreference = readPreference;

      I actually solved the problem and started to get reads from secondaries.

      If this is not a bug, please provide an example on how should read preference be set in a sharded replicaset, because after trying countless of options I did not manage to make it work.

            Assignee:
            Christian Amor Kvalheim
            Reporter:
            Andrius Virbi?ianskas
            None
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: