-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 1.8.3
-
Component/s: None
-
None
According to the connection string documentation at http://docs.mongodb.org/manual/reference/connection-string/#uri.readPreference one should be able to add ?readPreference=secondary and send all reads to secondaries, all writes to primary.
When adding this to a connection string and connecting to a secondary, it seems to still attempt to query the master:
/home/doug/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/mongo-1.8.3/lib/mongo/db.rb:535:in `command': Database command 'count' failed: (errmsg: 'not master'; note: 'from execCommand'; ok: '0.0'). (Mongo::OperationFailure) from /home/doug/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/mongo-1.8.3/lib/mongo/cursor.rb:172:in `count' from /home/doug/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/mongo-1.8.3/lib/mongo/collection.rb:957:in `count'