-
Type: Bug
-
Resolution: Fixed
-
Priority: Unknown
-
Affects Version/s: None
-
Component/s: None
-
None
-
Minor Change
FSBucket's read_preference method is currently written as follows:
def read_preference @read_preference ||= options[:read] || database.read_preference end
options[:read] is a Hash, database.read_preference is a BSON::Document. Thus depending on what value is passed into constructor of FSBucket, the value returned from read_preference may change type.
The docstring is also incorrect on the constructor claiming :read option is a string (it is actually a Hash), and on read_preference method claiming to return the preference as a ServerSelector object (the return value is either a Hash or a BSON::Document).
For consistency with client and database objects let's change FSBucket to return read preference always as a BSON::Document. Unfortunately this is an incompatible change.
The same issue affects Grid::FSBucket::Stream::Read.