-
Type:
Task
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
DB Integration & Observability
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Explaining a bulkWrite with a single update or delete op reports the queryShapeHash of the equivalent standalone update/delete command, not the bulkWrite op shape hash recorded in $queryStats. The two hashes differ by design, so the hash from explain cannot be used to find the bulkWrite entry in $queryStats.
- mongos: cluster_bulk_write_cmd.h converts the op into a standalone update/delete request and runs the standalone explain path, which computes the update/delete shape hash.
- mongod: bulkWrite explain calls write_ops_exec::explainUpdate / explainDelete, which compute the update/delete shape hash.
Scope
- For a bulkWrite explain on mongos and mongod, compute and report the bulkWrite op shape hash instead.
- Keep the single-statement rule used for update/delete explain: bulkWrite explain already accepts exactly one op and rejects inserts, so the hash is only computed for that single update or delete op.
Testing
- jstest: for the same single-op bulkWrite, the queryShapeHash in explain output (mongos and mongod) matches the one in the $queryStats entry.