In mongodb/mongo-php-driver#780, a user was reporting some issues executing bulk updates with an unacknowledged write concern. Since he was connecting to a MongoDB 3.4 server, each update in the bulk write was issued in its own OP_UPDATE message. While investigating his script with APM, I noticed that executing a bulk write with five update statements resulted in five CommandStartedEvents; however, the command document attached to each CommandStartedEvent included the full bulk write. This made it appear as if 25 updates were being executed instead of five.
I believe this may be due to _mongoc_write_command_update_legacy() calling _mongoc_monitor_legacy_write() with the full command struct instead of a synthetic command that contains the single statement being executed.
If so, this is likely also an issue for _mongoc_write_command_delete_legacy() and _mongoc_write_command_insert_legacy() (depending how documents are split for each OP_INSERT) message).
- is related to
-
CDRIVER-3035 Always allow bulk OP_INSERTs to accommodate unacknowledged write concerns
- Closed