diff options
author | Davis Haupt <davis.haupt@mongodb.com> | 2022-04-07 18:34:19 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-04-07 19:55:49 +0000 |
commit | 88f2f24c6732c33870280aadcae7bbeb1e3a9fce (patch) | |
tree | c6786b4ddad67a8488dca253ef59561811a35367 /src/mongo/db/commands/write_commands.cpp | |
parent | 6cea72b5a8ac938a2e398e653362b55fe4a5f012 (diff) | |
download | mongo-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.cpp | 16 |
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); |