-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
Fully Compatible
-
ALL
-
v4.2
-
-
Sharding 2019-12-02, Sharding 2019-12-16, Sharding 2019-12-30, Sharding 2020-01-13
-
(copied to CRM)
On the mongos, we can run rs.slaveOk() to set the read preference to secondaryPreferred.
After running rs.slaveOk() on the mongos, the insert operation will still be routed to the primary so the insert will succeed.
However, ensureIndex will be routed to the secondary, so this command would fail.