[GODRIVER-1239] mongo.Client's Ping method ignores read preference Created: 19/Aug/19 Updated: 28/Oct/23 Resolved: 28/Aug/19 |
|
| Status: | Closed |
| Project: | Go Driver |
| Component/s: | CRUD |
| Affects Version/s: | None |
| Fix Version/s: | 1.1.1 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Matthew Chiaravalloti | Assignee: | Alice Thum |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
In the (mongo.Client).Ping(context.Context, *readpref.ReadPref) method, it looks like the ReadPref argument isn't actually used. The Client 's readpref is also not used as the default when running the command. Instead, it seems that on this line, the read preference defaults to primary. Ping should use the argued read preference if it is non-nil, and should use c.readPreference if the argument is nil. This should be easily fixed by adding options.RunCmd().SetReadPreference(rp) to this method call. |
| Comments |
| Comment by Divjot Arora (Inactive) [ 27/Aug/19 ] |
|
commit link: https://github.com/mongodb/mongo-go-driver/commit/1200072987b5e44a7417684e573acbdb7bc94538 |
| Comment by Alice Thum [ 27/Aug/19 ] |
|
https://review.gerrithub.io/c/mongodb/mongo-go-driver/+/466470 |