summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/write_commands.cpp
diff options
context:
space:
mode:
authorDavis Haupt <davis.haupt@mongodb.com>2022-04-07 18:34:19 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-04-07 19:55:49 +0000
commit88f2f24c6732c33870280aadcae7bbeb1e3a9fce (patch)
treec6786b4ddad67a8488dca253ef59561811a35367 /src/mongo/db/commands/write_commands.cpp
parent6cea72b5a8ac938a2e398e653362b55fe4a5f012 (diff)
downloadmongo-88f2f24c6732c33870280aadcae7bbeb1e3a9fce.tar.gz
SERVER-65237 Server-side rewrite in explain for delete and update commands
Diffstat (limited to 'src/mongo/db/commands/write_commands.cpp')
-rw-r--r--src/mongo/db/commands/write_commands.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/mongo/db/commands/write_commands.cpp b/src/mongo/db/commands/write_commands.cpp
index 2a6279e6388..93e9cea9c64 100644
--- a/src/mongo/db/commands/write_commands.cpp
+++ b/src/mongo/db/commands/write_commands.cpp
@@ -1537,6 +1537,13 @@ public:
UpdateRequest updateRequest(request().getUpdates()[0]);
updateRequest.setNamespaceString(request().getNamespace());
+ if (shouldDoFLERewrite(request())) {
+ updateRequest.setQuery(
+ processFLEWriteExplainD(opCtx,
+ write_ops::collationOf(request().getUpdates()[0]),
+ request(),
+ updateRequest.getQuery()));
+ }
updateRequest.setLegacyRuntimeConstants(request().getLegacyRuntimeConstants().value_or(
Variables::generateRuntimeConstants(opCtx)));
updateRequest.setLetParameters(request().getLet());
@@ -1677,7 +1684,14 @@ public:
deleteRequest.setLegacyRuntimeConstants(request().getLegacyRuntimeConstants().value_or(
Variables::generateRuntimeConstants(opCtx)));
deleteRequest.setLet(request().getLet());
- deleteRequest.setQuery(request().getDeletes()[0].getQ());
+
+ BSONObj query = request().getDeletes()[0].getQ();
+ if (shouldDoFLERewrite(request())) {
+ query = processFLEWriteExplainD(
+ opCtx, write_ops::collationOf(request().getDeletes()[0]), request(), query);
+ }
+ deleteRequest.setQuery(std::move(query));
+
deleteRequest.setCollation(write_ops::collationOf(request().getDeletes()[0]));
deleteRequest.setMulti(request().getDeletes()[0].getMulti());
deleteRequest.setYieldPolicy(PlanYieldPolicy::YieldPolicy::YIELD_AUTO);