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

SMC options are not correctly converted to Ruby options

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 2.19.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible

      The driver implements converters between SMC and Ruby options. SMC stands for "Standard MongoDB Camelcase" and refers to the client options as they are specified in, most notably, unified spec test files. SMC options are different from URI options because of value types - URI options always have string values, while SMC options have resolved types like integers. (SMC options are sometimes called "URI options" in specs, but this is not technically correct.)

      The SMC to Ruby option conversion currently converts the option name from camel case to underscore but doesn't perform value conversion in most cases (there is a single exception for readConcernLevel which is converted to symbol). This causes a problem with the timeout options that become 1000x larger than they must be because the option is specified as a millisecond value in SMC and the Ruby option is supposed to be in seconds.

      The reason the conversion wasn't done to begin with was because the values of SMC options, as mentioned, are not strings and thus cannot be simply fed to the various converters defined for URI options. These converters will need to be adjusted to take SMC input or a new set of converters will be needed. Based on the timeout option we prototyped with Neil, adjusting existing converters seems feasible.

      Add the call to convert option values to SMC-to-Ruby converter method
      Adjust existing converters to handle SMC option values
      Check if the to_sym special case for readConcernLevel remains necessary, remove it if not
      Add tests converting SMC options to Ruby ones for each distinct defined converter

      Note that this is not a user-visible problem because SMC options are only used internally in the test suite (at least until https://github.com/mongodb/mongo-ruby-driver/pull/2596 lands which proposes to use that logic to reconstruct the URI from components).

            Assignee:
            neil.shweky@mongodb.com Neil Shweky (Inactive)
            Reporter:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: