Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-2273

Do not include default write concern in insert, update, and delete commands

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.9.0
    • Affects Version/s: 1.7.0
    • Component/s: libmongoc
    • Labels:
      None

      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.

            Assignee:
            jmikola@mongodb.com Jeremy Mikola
            Reporter:
            jmikola@mongodb.com Jeremy Mikola
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: