diff options
author | Katherine Wu <katherine.wu@mongodb.com> | 2020-04-27 11:32:40 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-04-28 21:57:39 +0000 |
commit | 53e1d78e950bb98f84fc0e0e48c341404f7f90ed (patch) | |
tree | 2b8c8cfb0fa31e1ec7b07d9f643947422368edd9 /src/mongo/db/pipeline/expression_context.cpp | |
parent | f0cf2ca62b4957587e5fe3a897b35b9a54873e23 (diff) | |
download | mongo-53e1d78e950bb98f84fc0e0e48c341404f7f90ed.tar.gz |
SERVER-46708 Support let variables in update command
Diffstat (limited to 'src/mongo/db/pipeline/expression_context.cpp')
-rw-r--r-- | src/mongo/db/pipeline/expression_context.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mongo/db/pipeline/expression_context.cpp b/src/mongo/db/pipeline/expression_context.cpp index 22f071c078c..beedcb28752 100644 --- a/src/mongo/db/pipeline/expression_context.cpp +++ b/src/mongo/db/pipeline/expression_context.cpp @@ -140,6 +140,7 @@ ExpressionContext::ExpressionContext(OperationContext* opCtx, std::unique_ptr<CollatorInterface> collator, const NamespaceString& nss, const boost::optional<RuntimeConstants>& runtimeConstants, + const boost::optional<BSONObj>& letParameters, bool mayDbProfile) : ns(nss), opCtx(opCtx), @@ -157,6 +158,16 @@ ExpressionContext::ExpressionContext(OperationContext* opCtx, } jsHeapLimitMB = internalQueryJavaScriptHeapSizeLimitMB.load(); + if (letParameters) { + // TODO SERVER-47713: One possible fix is to change the interface of everything that needs + // an expression context intrusive_ptr to take a raw ptr. + auto intrusiveThis = boost::intrusive_ptr{this}; + ON_BLOCK_EXIT([&] { + intrusiveThis.detach(); + unsafeRefDecRefCountTo(0u); + }); + variables.seedVariablesWithLetParameters(intrusiveThis, *letParameters); + } } void ExpressionContext::checkForInterrupt() { |