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

Expose server version value type

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major - P3 Major - P3
    • None
    • None
    • Testing
    • None

    Description

      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.)

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated: