Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-1341

Validations for read mode

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.6.0
    • 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:

       

      1. 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 ([]).
      2. If the read option value is a hash or similar object having the :mode key, require that the mode is one of recognized modes.

            Assignee:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Reporter:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: