[CXX-1554] Expose server version value type Created: 16/Apr/18  Updated: 30/Jun/23

Status: Backlog
Project: C++ Driver
Component/s: Testing
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Ryan Timmons Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by CXX-1037 Add Evergreen tasks for running integ... Closed
Epic Link: CXX usability improvements

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


Generated at Wed Feb 07 22:03:03 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.