[CDRIVER-1005] Improve wire version checks Created: 18/Nov/15  Updated: 06/Feb/23

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

Type: Improvement Priority: Trivial - P5
Reporter: Hannes Magnusson Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on CDRIVER-1527 Add mongoc_client_[read|write|read_wr... Closed
Related
related to CDRIVER-689 Detect incompatible wire versions Closed

 Description   

We have a lot of "manual" wire version checks all over the place.
These checks generally check the upper bound, making sure the maxWireVersion is at least X, but we generally don't check that the minWireVersion is equals-to-or-less then X too.

This isn't an issue today as the server hasn't yet raised its minWireVersion – but when the day comes, our checks become wrong.

We should refactor these checks into generic wire version compatibility helpers.

In certain cases we should also raise an error when the user attempts to use certain functionality that isn't available by the server.
This happens for example when a user specifically provides readConcern, but the server doesn't support it (e.g. MongoDB 3.0).

It would be nice to be able to automatically set this error too, so the error message and codes would be consistent throughout.

Then we could have something along the way of

 if (_mongoc_read_concern_version_error (read_concern, server_description, &error)) {
    return false;
 }
 
 _mongoc_append_read_concern (&command, read_concern);
 


Generated at Wed Feb 07 21:11:16 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.