summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline
diff options
context:
space:
mode:
authorTed Tuckman <ted.tuckman@mongodb.com>2022-01-05 19:49:06 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-01-05 20:35:23 +0000
commit059874fc180489c052fa89d05f8432a949ed0a32 (patch)
tree13ea464da0652b43279c6bb39f133332c96d8126 /src/mongo/db/pipeline
parente633ee07371dd276469766698d40f44f930b17ba (diff)
downloadmongo-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.cpp6
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();