summaryrefslogtreecommitdiff
path: root/src/mongo/db/ops
diff options
context:
space:
mode:
authorIan Boros <ian.boros@mongodb.com>2020-03-20 16:22:40 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-03-31 19:01:41 +0000
commitf105232d6594336e35cfee8f7f6d4ef49182ce84 (patch)
tree70a4c7faa606b0ed08b46e14c7d18e3797a50e61 /src/mongo/db/ops
parent0487d9f93e2c9e30485f41c5c68a78d8d713e60a (diff)
downloadmongo-f105232d6594336e35cfee8f7f6d4ef49182ce84.tar.gz
SERVER-46863 prevent collator mismatch in findAndModify/update
Diffstat (limited to 'src/mongo/db/ops')
-rw-r--r--src/mongo/db/ops/parsed_update.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/mongo/db/ops/parsed_update.cpp b/src/mongo/db/ops/parsed_update.cpp
index b495d48df9c..cdcc2428029 100644
--- a/src/mongo/db/ops/parsed_update.cpp
+++ b/src/mongo/db/ops/parsed_update.cpp
@@ -121,10 +121,13 @@ Status ParsedUpdate::parseQueryToCQ() {
auto qr = std::make_unique<QueryRequest>(_request->getNamespaceString());
qr->setFilter(_request->getQuery());
qr->setSort(_request->getSort());
- qr->setCollation(_request->getCollation());
qr->setExplain(_request->isExplain());
qr->setHint(_request->getHint());
+ // We get the collation off the ExpressionContext because it may contain a collection-default
+ // collator if no collation was included in the user's request.
+ qr->setCollation(_expCtx->getCollatorBSON());
+
// Limit should only used for the findAndModify command when a sort is specified. If a sort
// is requested, we want to use a top-k sort for efficiency reasons, so should pass the
// limit through. Generally, a update stage expects to be able to skip documents that were