[CDRIVER-2213] Add write concern option to find_and_modify_with_opts Created: 17/Jul/17  Updated: 28/Oct/23  Resolved: 01/Sep/17

Status: Closed
Project: C Driver
Component/s: libmongoc
Affects Version/s: None
Fix Version/s: 1.8.0

Type: Task Priority: Minor - P4
Reporter: Patrick Freed Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Gantt Dependency
has to be done before CXX-1349 Implement manual read/write concern t... Closed
Related
is related to CDRIVER-1048 Add generic mongoc_find_and_modify_op... Closed
is related to CDRIVER-2227 "Commands with opts" tutorial Closed
Backwards Compatibility: Minor Change

 Description   

The findAndModify command accepts a write concern option different from the collection-wide write concern. As such, mongoc_collection_find_and_modify_with_opts should accept a write concern as an option via find_and_modify_opts_t.

According to read/write concern spec, this function should also throw an error if a write concern is specified and maxWireVersion < 4.



 Comments   
Comment by Githook User [ 01/Sep/17 ]

Author:

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

Message: CDRIVER-2213 findAndModify respects writeConcern opt
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/21a22353f2773e0100bb8596849ce60c9d5abcea

Comment by Githook User [ 01/Sep/17 ]

Author:

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

Message: CDRIVER-2213 findAndModify respects writeConcern opt
Branch: r1.8
https://github.com/mongodb/mongo-c-driver/commit/ab0606aadb61b01347069f46387b8966b64cd6f5

Comment by A. Jesse Jiryu Davis [ 20/Jul/17 ]

We still need to check whether our mongoc_collection_find_and_modify_with_opts throws an error if wire version < 4.

Comment by A. Jesse Jiryu Davis [ 20/Jul/17 ]

You can use mongoc_write_concern_append (write_concern, bson) to create an "opts" that includes the write concern, then pass that to mongoc_find_and_modify_opts_append.

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