The WRITE_CONCERN_DOC() macro in mongoc-write-command.c casts a const mongoc_write_concern_t* to mongoc_write_concern_t* in order to call _mongoc_write_concern_get_bson(), which may modify the state of the write concern by freezing it.
It would be preferable if this used _BSON_APPEND_WRITE_CONCERN(), which makes a temporary copy of the write concern if it is not already frozen (thereby leaving a non-frozen write concern as-is).
- is duplicated by
-
CDRIVER-2284 Invalidate generated BSON instead of freezing read and write concerns
- Closed
- is related to
-
CDRIVER-2273 Do not include default write concern in insert, update, and delete commands
- Closed