- 
    Type:
Improvement
 - 
    Resolution: Fixed
 - 
    Priority:
Minor - P4
 - 
    Affects Version/s: None
 - 
    Component/s: Change streams
 - 
    None
 
- 
        Query Execution
 - 
        Fully Compatible
 - 
        QE 2025-05-12
 - 
        None
 
- 
        None
 - 
        None
 - 
        None
 - 
        None
 - 
        None
 - 
        None
 
- 
        0
 
change_stream_event_transform.cpp currently performs unconditional lookups of certain fields in the input Document, but the looked-up values will only be used under certain conditions.
For example this is true for the fields applyOpsIndex and applyOpsTs, which are looked up here, but the looked-up values are only used when preimages are enabled.
We also unconditionally call MutableDocument::addField(StringData, Value) unconditionally for several fields that may be missing / have no value.
addField will unconditionally call appendField() on the underlying storage object. And appendField() will unconditionally add the Value to the storage, even if Value::missing() is true.
This work can be avoided for fields that do not have a value set for them.