summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/expression.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/pipeline/expression.cpp')
-rw-r--r--src/mongo/db/pipeline/expression.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/mongo/db/pipeline/expression.cpp b/src/mongo/db/pipeline/expression.cpp
index 9d21614c1ed..2ac2bd0402f 100644
--- a/src/mongo/db/pipeline/expression.cpp
+++ b/src/mongo/db/pipeline/expression.cpp
@@ -2623,7 +2623,10 @@ Value ExpressionMeta::evaluate(const Document& root, Variables* variables) const
case MetaType::kIndexKey:
return metadata.hasIndexKey() ? Value(metadata.getIndexKey()) : Value();
case MetaType::kSortKey:
- return metadata.hasSortKey() ? Value(metadata.getSortKey()) : Value();
+ return metadata.hasSortKey()
+ ? Value(DocumentMetadataFields::serializeSortKey(metadata.isSingleElementKey(),
+ metadata.getSortKey()))
+ : Value();
default:
MONGO_UNREACHABLE;
}