-
Type: Improvement
-
Resolution: Fixed
-
Priority: Minor - P4
-
Affects Version/s: 2.5.3
-
Component/s: None
-
None
Currently mongo-ruby-driver does not perform any validation on read option to Client constructor. In particular the following is silently accepted:
Mongo::Client.new(['127.0.0.1:27017'], read: :nearest)
... but the read setting is ignored since it is treated as a hash.
Suggested changes are:
- Reject read values which are strings and symbols. A stricter check would require the value to be a Hash but this can break clients which pass class instances that are not derived from Hash but implement key access ([]).
- If the read option value is a hash or similar object having the :mode key, require that the mode is one of recognized modes.