summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Boros <matt.boros@mongodb.com>2022-09-12 18:24:49 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-09-20 16:07:35 +0000
commit94fb7dfc8b974f1f5343e7ea394d0d9deedba50e (patch)
treecdc2a9d81caa9a52bbc15d99b4e1c7b3bcc9140e
parent0da3dac395ace03613f6073fff40f49fb84dc707 (diff)
downloadmongo-r6.0.2-rc1.tar.gz
SERVER-69005 $internalBoundedSort should not accept empty sort patternr6.0.2-rc1r6.0.2
(cherry picked from commit a14ebbf41e0ae4346e806e1ac5d7a3fdaa42d529)
-rw-r--r--src/mongo/db/pipeline/document_source_sort.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/mongo/db/pipeline/document_source_sort.cpp b/src/mongo/db/pipeline/document_source_sort.cpp
index 1ccc8a5d58d..3ba411e0499 100644
--- a/src/mongo/db/pipeline/document_source_sort.cpp
+++ b/src/mongo/db/pipeline/document_source_sort.cpp
@@ -485,6 +485,10 @@ intrusive_ptr<DocumentSourceSort> DocumentSourceSort::parseBoundedSort(
BSONElement key = args["sortKey"];
uassert(6369904, "$_internalBoundedSort sortKey must be an object", key.type() == Object);
+ // Empty sort pattern is not allowed for the bounded sort.
+ uassert(6900501,
+ "$_internalBoundedSort stage must have at least one sort key",
+ !key.embeddedObject().isEmpty());
SortPattern pat{key.embeddedObject(), expCtx};
{