diff options
author | Ted Tuckman <ted.tuckman@mongodb.com> | 2022-01-05 19:49:06 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-01-05 20:35:23 +0000 |
commit | 059874fc180489c052fa89d05f8432a949ed0a32 (patch) | |
tree | 13ea464da0652b43279c6bb39f133332c96d8126 /src/mongo/db/pipeline | |
parent | e633ee07371dd276469766698d40f44f930b17ba (diff) | |
download | mongo-059874fc180489c052fa89d05f8432a949ed0a32.tar.gz |
SERVER-62364 Fix $fill arbitrary value filling bug
Diffstat (limited to 'src/mongo/db/pipeline')
-rw-r--r-- | src/mongo/db/pipeline/document_source_fill.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/mongo/db/pipeline/document_source_fill.cpp b/src/mongo/db/pipeline/document_source_fill.cpp index beb335bf31f..ea69f0cdf0a 100644 --- a/src/mongo/db/pipeline/document_source_fill.cpp +++ b/src/mongo/db/pipeline/document_source_fill.cpp @@ -96,8 +96,10 @@ std::list<boost::intrusive_ptr<DocumentSource>> createFromBson( } if (auto&& unparsedValueExpr = parsedSpec.getValue()) { // Value fields are BSONAnyType. - auto valueObj = unparsedValueExpr.value().getElement().wrap(fieldName); - addFieldsSpec.appendElements(valueObj); + auto valueElem = unparsedValueExpr.value().getElement(); + BSONObj fullFieldSpec = + BSON(fieldName << BSON("$ifNull" << BSON_ARRAY("$" + fieldName << valueElem))); + addFieldsSpec.appendElements(fullFieldSpec); } } setWindowFieldsOutputSpec.done(); |