[GODRIVER-23] SlaveOk bit not set when connected directly to a secondary Created: 26/May/17 Updated: 28/Oct/23 Resolved: 30/May/17 |
|
| Status: | Closed |
| Project: | Go Driver |
| Component/s: | Wire Protocol |
| Affects Version/s: | None |
| Fix Version/s: | 0.0.1 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Craig Wilson | Assignee: | Craig Wilson |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||
| Description |
|
When connected directly (connect=direct), the slaveOk bit isn't set when connected to a secondary. |
| Comments |
| Comment by Sebastian Bauer [ 30/Apr/18 ] |
|
But what isĀ the correct way to connect directly to a replica set member when "connect=direct" is still not enough? How to do something like "rs.setSlaveOk()"? Thank you! |
| Comment by Jeffrey Yemin [ 30/May/17 ] |
|
See https://github.com/mongodb/specifications/blob/master/source/server-selection/server-selection.rst#topology-type-single. It indicates that slaveOK should be set regardless of read preference when directly connected to a replica set member. |
| Comment by Craig Wilson [ 28/May/17 ] |
|
The driver's behavior is correct here. Just because we are directly connected to a server doesn't mean we should automatically set the slave ok bit. Hence, the solution is to also set the readpreference to something that will set the slave ok bit, like nearest. |