-
Type: Bug
-
Resolution: Done
-
Priority: Critical - P2
-
Affects Version/s: 2.4
-
Component/s: None
-
None
Pre-2.3.1 versions of mongos do not support $readPreference for commands. In most cases this doesn't matter but some commands fail if $readPreference is included and the command document is not wrapped in $query.
The workaround to provide maximum backward compatibility is to not send $readPreference to mongos if the mode is PRIMARY. Since PRIMARY is the default it's redundant anyway. We will also only send $readPreference for SECONDARY_PREFERRED if tags are being used. Setting the slaveOkay wire protocol flag has the exact same effect.