Uploaded image for project: 'MongoDB Database Tools'
  1. MongoDB Database Tools
  2. TOOLS-2504

Setting connection options equal to zero values will never cause conflicts with a URI

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 100.0.0
    • Component/s: None
    • None

      The current implementation of TOOLS-2459 doesn't throw a conflict in all the cases that it should. This is because the way we are using the go-flags package means we can't tell for sure if an option has been set or not. The closest approximation is by checking if the option is different from its default value. But this causes an issue if a user intentionally set the default value of an option.

      For example the following combination of arguments would not throw an error even though clearly there has been a mistake:

       

      --dialTimeout 3 --uri="mongodb://foo/?connectTimeoutMS=5000"
      --compressors none --uri="mongodb://foo/?compressors=snappy"
      --ssl false --uri="mongodb://foo/?tls=true"

      There are several possible solutions to this:

      • Use pointers for all option values.
      • Use go-flags' Command objects so we have access to their Option type. This type can tell us whether or not it has been set.
      • Use a custom option type.
      • Switch to a different CLI framework such as spf13/cobra or urfave/cli (probably a bit drastic).

            Assignee:
            Unassigned Unassigned
            Reporter:
            tim.fogarty@mongodb.com Tim Fogarty
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: