-
Type:
Bug
-
Resolution: Done
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: Aggregation Framework
-
None
-
ALL
-
None
-
None
-
None
-
None
-
None
-
None
-
None
The addToBsonObj calls below should be passed requireExpression == true. I've already written some tests, and the fix is pretty straightforward.
void DocumentSourceGroup::sourceToBson(
BSONObjBuilder *pBuilder, bool explain) const {
BSONObjBuilder insides;
/* add the _id */
pIdExpression->addToBsonObj(&insides, Document::idName.c_str(), false);
/* add the remaining fields */
const size_t n = vFieldName.size();
for(size_t i = 0; i < n; ++i) {
intrusive_ptr<Accumulator> pA((*vpAccumulatorFactory[i])(pExpCtx));
pA->addOperand(vpExpression[i]);
pA->addToBsonObj(&insides, vFieldName[i], false);
}
pBuilder->append(groupName, insides.done());
}
May also need to similarly change Accumulator serialization.