-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 1.8.3
-
Component/s: None
-
None
When running commands the ReadPreference is overridden and the command is sent to the Primary if the command is not white listed as being allowed to be run on a Secondary. This overriding should only be done when connected to a ReplicaSet.
However, when using Automatic ConnectionMode a DiscoveringMongoServerProxy is used, and the actual type of the cluster is not known until after Connect has been called.
The code that reroutes commands to the primary should ensure that the proxy type is not Unknown before deciding whether to reroute the command or not.