Find no longer overrides the collection's read preference and read concern

Closes #342 (closed)

Adds withReadPreference(HasReadPreference) and withReadConcern(HasReadConcern) helpers next to the existing withWriteConcern(HasWriteConcern) in both drivers. They leave the collection as it is when the option isn't set.

The existing readPreference and readConcern tests in FindOperations can't observe this: on a standalone server the driver doesn't send $readPreference at all. I checked it locally against a single-node replica set with a CommandListener on the find command, for both drivers:

Case Before After
Collection set to secondaryPreferred / majority, no options primaryPreferred, no read concern secondaryPreferred, majority
Same collection, call sets Primary / Local primaryPreferred, local primaryPreferred, local
Collection left at defaults, no options primaryPreferred, no read concern primaryPreferred, no read concern

I can turn that into a test if you'd like one, but it needs a replica set, which CI doesn't run.

readReadPreference() and readReadConcern() in driver-shared-official are no longer used. I left them in place since they're public; happy to remove them.

All four integration suites pass against that replica set.

Merge request reports

Loading
Loading