[CDRIVER-2508] Prohibit writeConcern values less than -1 Created: 15/Feb/18  Updated: 28/Oct/23  Resolved: 15/Feb/18

Status: Closed
Project: C Driver
Component/s: libmongoc, uri
Affects Version/s: None
Fix Version/s: 1.10.0

Type: Improvement Priority: Major - P3
Reporter: A. Jesse Jiryu Davis Assignee: A. Jesse Jiryu Davis
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to CDRIVER-628 Deprecate MONGOC_WRITE_CONCERN_W_ERRO... Closed
is related to CDRIVER-2490 Resync tests to update handling of in... Closed
Backwards Compatibility: Minor Change

 Description   

We use writeConcern values of "w" -2 through -4 to express special internal meanings. By accident, we also allow these values in URIs like:

mongodb://host/?w=-4

and also in BSON documents passed as "opts":

bson_t *opts;
 
opts = BCON_NEW ("writeConcern", "{", "w", BCON_INT32 (-4), "}");
mongoc_collection_insert_one (collection, document, opts);

In 1.10, we'll prohibit "w" values less than -1.

"w=-1" is still allowed as a deprecated alias for "w=0" (CDRIVER-628).



 Comments   
Comment by Githook User [ 20/Feb/18 ]

Author:

{'email': 'jesse@mongodb.com', 'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis'}

Message: CDRIVER-2508 correct NEWS entry for negative "w"
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/5dbcc104b3267b19904fd4589b9da9715bd41898

Comment by A. Jesse Jiryu Davis [ 15/Feb/18 ]

Good point, thanks. I'll update the NEWS entry, this only affects BSON opts.

Comment by Jeremy Mikola [ 15/Feb/18 ]

For the record, I believe values less than -1 have been rejected in the URI since 1.9.0 (CDRIVER-2234). See: 7ffa3f0.

That is when PHPC stopped using such values in our URI tests: f609ac7.

Comment by A. Jesse Jiryu Davis [ 15/Feb/18 ]

Fixed in patch for CDRIVER-2490.

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