3e34af3 added logic to omit specifying default read and write concerns (i.e. an empty document value) in command documents. However, the code path for insert, update, and delete is still prone to adding a "writeConcern" key with an empty document value to the command document.
redbeard0531 confirmed that mongod versions going back to 2.6 treat an empty document for "writeConcern" as if the option had never been specified, but I think it would be preferable if libmongoc was consistent here and omitted the option on its own.
This came up while some users were analyzing logs for the PHP driver (see: mongodb/mongo-php-library#326) and did not expect to see a "writeConcern" field at all. After adding logic in the PHP library to ignore default read and write concerns in commands (PHPC-976 and PHPLIB-261) I realized that libmongoc was still adding default values for insert, update, and delete.
- is duplicated by
-
CDRIVER-2383 Write commands can send empty write concern
- Closed
- is related to
-
PHPC-976 Create isDefault() method for read and write concerns
- Closed
-
PHPLIB-261 Omit default read and write concern from commands
- Closed
- related to
-
CDRIVER-2274 _mongoc_write_command_init() may freeze const mongoc_write_concern_t
- Closed
- links to