Uploaded image for project: 'C++ Driver'
  1. C++ Driver
  2. CXX-1554

Expose server version value type

    • Type: Icon: Improvement Improvement
    • Resolution: Won't Do
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Testing
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      We have a number of places in the code (all in tests and examples) that check the server version (grep for get_server_version).

      This code

      1. relies on string-comparison (isn't really semver compliant)
      2. probably is not what we'd want users to actually do if they have server-version-dependent code-paths

      Instead we could support a mongocxx::version value-type or something that a client could expose:

      mongocxx::version minimum {3,6,0};
      mongocxx::version actual = client.server_version();
      if (actual < minimum) {
          throw std::logic_error("Server version " + actual + " < minimum " + minimum);
      }
      

      (Just an idea I had - fine to resolve if others don't see the value or if there's a better alternative.)

            Assignee:
            Unassigned Unassigned
            Reporter:
            ryan.timmons@mongodb.com Ryan Timmons
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: