-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Aggregation Framework, Internal Code
-
Fully Compatible
-
ALL
-
Query 2018-09-24
In SERVER-36100, charlie.swanson and I noticed that MutableDocument::hasField() tests for existence by asking its underlying storage if it has the field in its hash table. However, this will be incorrect if the field used to exist but has cleared (for example, by a $project earlier in the pipeline).
We both used a static analysis tool and believed there to be no callers of this function, but when I attempted to remove it I found there exists a single caller:
cluster_aggregate.cpp
if (opCtx->getTxnNumber()) { invariant(!cmdForShards.hasField(OperationSessionInfo::kTxnNumberFieldName)); cmdForShards[OperationSessionInfo::kTxnNumberFieldName] = Value(static_cast<long long>(*opCtx->getTxnNumber())); }
As part of this ticket we should either fix the function or delete it and replace the caller's usage with an equivalent check.