[CDRIVER-3732] mongoc_client_select_server incorrectly documents default read preference Created: 01/Jul/20  Updated: 28/Oct/23  Resolved: 18/Dec/20

Status: Closed
Project: C Driver
Component/s: docs
Affects Version/s: None
Fix Version/s: 1.18.0, 1.18.0-alpha

Type: Bug Priority: Major - P3
Reporter: Kevin Albertson Assignee: Samantha Ritter (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

The documentation of mongoc_client_select_server claims that the read preference is inherited by the client if NULL:

prefs: An optional mongoc_read_prefs_t. If for_writes is true, prefs must be NULL. Otherwise, use prefs to customize server selection, or pass NULL to use the read preference configured on the client.

But the implemented behavior appears to default to primary (much like the generic command helpers like mongoc_client_command_simple ().

We should validate this behavior. The existing write concern / read concern / read preference inheritance tests (in test-mongoc-opts.c) do not test mongoc_client_select_server.

See this PR conversation for more context.
https://github.com/mongodb/mongo-php-driver/pull/1144#discussion_r448443865



 Comments   
Comment by Githook User [ 18/Dec/20 ]

Author:

{'name': 'Samantha Ritter', 'email': 'samantha.ritter@10gen.com', 'username': 'samantharitter'}

Message: CDRIVER-3732 document correct read preference behavior for mongoc_client_select_server
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/c5363e78a81e5290d1f46342ccaa4f0ca5cb81d6

Comment by Samantha Ritter (Inactive) [ 16/Dec/20 ]

Code review: https://github.com/mongodb/mongo-c-driver/pull/710

Generated at Wed Feb 07 21:18:52 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.