_mongoc_bulk_operation_update_append takes an extra_opts parameter, which when non-empty is concatenated to bson_t opts and passed as the update statement options to _mongoc_write_command_update_append or _mongoc_write_command_init_update. At runtime, the extra_opts parameter provided to _mongoc_bulk_operation_update_append originates from the extra field on the corresponding bulk write option struct.
Looking at generate-opts.py, all of the bulk write structs specify allow_extra=False, so the extra field on update/replace option structs should only ever be an empty document (initialized in the parse method and later destroyed in cleanup).
If this analysis is correct, the extra_opts parameter should simply be removed from the various mongoc-bulk-operation.c functions.
Notably, the delete operations do not reference extra at all. The insert operations do reference extra and pass it to _mongoc_write_command_init_insert as the cmd_opts, which is likely also dead code (to be removed in CDRIVER-4199 when introducing the top-level comment option).
- is related to
-
CDRIVER-2665 Consider allow_extra=True for bulk option structs
- Closed
-
CDRIVER-4199 Add support for the comment field to all helpers
- Closed