-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Unknown
-
None
-
Affects Version/s: None
-
Component/s: Bulk API, Performance
-
Not Needed
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Use Case
As a... developer using insertMany/bulkWrite at high volume.
I want... the driver to stop serializing each document twice per write.
So that... bulk writes consume less CPU and stop blocking the event loop.
User Experience
- Bulk writes (insertMany, bulkWrite, fluent bulk ops) do one BSON pass instead of two, cutting encode CPU by roughly half.
- The gain is synchronous, event-loop-blocking work removed, so apps see lower latency on other operations sharing the process during large bulk writes. Biggest wins on high doc counts and many-field documents.
- Not a bug; no correctness impact. Behavior is unchanged (including ignoreUndefined defaults).
Dependencies
- N/A
Risks/Unknowns
- Switches the wire encoding of documents/updates/deletes from a type-0 array to an OP_MSG document sequence (type 1); command monitoring must reconstruct these to arrays or APM assertions break.
- Must keep the array path under auto-encryption (libmongocrypt needs the plaintext command).
Acceptance Criteria
Implementation Requirements
- Serialize each op once in the bulk path; reuse the bytes for the max-size check, batch splitting, and the wire message.
- Preserve batch-splitting behavior and default ignoreUndefined: false semantics (no data-shape change on upgrade).
- Fall back to the array path under auto-encryption and for non-bulk callers.
Testing Requirements
- Existing CRUD / bulk / retryable-write / transactions / CSE spec tests pass unchanged.
- driver_bench small_doc_bulk_insert / large_doc_bulk_insert show improved throughput in CI.
Documentation Requirements
- N/A
Follow Up Requirements
- N/A
- is related to
-
NODE-6325 Implement Document Sequence Support
-
- Closed
-