-
Type: New Feature
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 1.5.0
-
Component/s: libmongoc
-
None
-
Fully Compatible
Rename "_with_write_concern" functions (introduced in CDRIVER-1322) to "_with_opts", accept a const bson_t opts instead a mongoc_write_concern_t:
mongoc_collection_aggregate_with_optsmongoc_collection_aggregate already has bson_t *options that be retrofitted- mongoc_collection_create_index_with_opts
- mongoc_collection_drop_index_with_opts
- mongoc_collection_drop_with_opts
- mongoc_collection_rename_with_opts
mongoc_database_create_collection_with_optsmongoc_database_create_collection already has bson_t *options that can be retrofitted- mongoc_database_drop_with_opts
For consistency with the rest of our API, the final parameters of each of these functions should be ordered like:
const bson_t *opts
bson_error_t *error
Or:
const bson_t *opts
bson_t *reply
bson_error_t *error
Their internal helper _mongoc_client_command_with_write_concern should become:
- _mongoc_client_command_with_opts
This function accepts a const bson_t "opts" instead of a mongoc_write_concern_t. Users can easily pass us a mongoc_write_concern_t in "opts" using mongoc_write_concern_append. The same rules currently enforced by _mongoc_client_command_with_write_concern MUST be enforced by the new _mongoc_client_command_with_opts:
- If "opts" has a "writeConcern" subdocument, append it to the command iff max wire version >= 5
- If "opts" has a "writeConcern" subdocument, parse the reply for "writeConcernError" and return false if there is a write concern error
Besides "writeConcern", I think other fields in "opts" are appended to the command without any validation.
- causes
-
CDRIVER-2679 Finish documenting "with_opts" functions
- Closed
- depends on
-
CDRIVER-1322 Support sending writeConcern for commands that write
- Closed