-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 3.0.0
-
Component/s: None
-
Empty show more show less
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.