summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorArun Banala <arun.banala@mongodb.com>2023-08-01 13:33:14 -0700
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-08-01 21:28:03 +0000
commite7d9f7ff262957ece83fc722f9ff35bf31ffa52d (patch)
tree04ba4d27325a59fddb715aff15fa4ddef8537d52 /src
parentf1f5acbdcc8d44961a3a31550d4385b3ec8c0b9c (diff)
SERVER-79592 [v5.0] Avoid server crash when using positional projection with collationr5.0.20-rc0
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/exec/projection_executor_utils.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/mongo/db/exec/projection_executor_utils.cpp b/src/mongo/db/exec/projection_executor_utils.cpp
index b77b330ff05..b363b811459 100644
--- a/src/mongo/db/exec/projection_executor_utils.cpp
+++ b/src/mongo/db/exec/projection_executor_utils.cpp
@@ -199,7 +199,14 @@ Document applyFindPositionalProjection(const Document& preImage,
// invariant to make sure this is the case indeed.
MatchDetails details;
details.requestElemMatchKey();
- invariant(matchExpr.matchesBSON(preImage.toBson(), &details));
+
+ // Ideally we should not assert for this case, but this is a temporary workaround. SERVER-72416
+ // should address this problem more cleanly.
+ uassert(7959200,
+ "None of the array elements matched the filter while applying positional projection. "
+ "If the collection was created with collation, this issue can be worked-around by "
+ "providing the collation as part of the query",
+ matchExpr.matchesBSON(preImage.toBson(), &details));
// At this stage we know that the 'input' document matches against the specified condition,
// but the matching array element may not be found. This can happen if the field, specified