mongoc-uri.c has several methods for checking whether an option may be set with a particular type. "w" is unique among the options in that it may be a positive integer or a string (e.g. negative integer as a string, "majority").
Currently, the option is only handled in the static mongoc_uri_parse_option() function, and it's not possible for other drivers (see: PHPC-353) to use the mongoc_uri_set_option_as_int32() and mongoc_uri_set_option_as_utf8() functions, since those rely on {{mongoc_uri_option_is_TYPE() functions to return true before the value is overridden or appended to the options BSON structure.
I propose that mongoc_uri_option_is_int32() and mongoc_uri_option_is_utf8() be changed to return true for the "w" option. To my knowledge, these are only declared in the private API and used by mongoc_uri_set_option_as_int32() (to control which options are allowed to be set with an integer) and mongoc_uri_parse_option().
- related to
-
PHPC-353 Support read preference and write concern in Manager options array
- Closed