-
Type: Bug
-
Resolution: Cannot Reproduce
-
Priority: Major - P3
-
None
-
Affects Version/s: 3.0.8, 3.2.1
-
Component/s: Shell
-
None
-
ALL
-
I'm not sure if I got this wrong, but I expect Mongo.setReadPref("secondary") to force reads to get redirected to the secondary nodes of a replica set. If I'm connected to the master of the set via mongo-shell, the shell should know about primary/secondary nodes. Problem is that if I query something (which is of course a read) the master handles my query, which is not what I want it to do (because I do some reporting stuff).
I also tried to set the readPref for single find(...) calls (with db.collection.find(
{email: "example@mail.com"}).readPref("secondary")), which didn't work neither.
If I connect to the secondary right away (when starting the mongo shell), this works as expected. The problem still exists, since I don't want to care to which server I connect (in case of primary/secondary node changes). Mongo drivers in python e.g. do support this.