summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNaama Bareket <naama.bareket@mongodb.com>2023-02-24 20:32:33 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-02-28 19:44:12 +0000
commitc7bd639a41b7001046be2a70d70ea92753912580 (patch)
tree504e97fe4d4041a261392b850e138b49a826f4e1 /src
parent962a7f752a755dcf74ecfb21793111cb1cdcb80d (diff)
downloadmongo-c7bd639a41b7001046be2a70d70ea92753912580.tar.gz
SERVER-73125: Set built-in variables on ExpressionContext of the validator
(cherry-picked from 7820a2ce672fffb91b9f03bd72c1cf827efc391e)
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/catalog/collection_impl.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/mongo/db/catalog/collection_impl.cpp b/src/mongo/db/catalog/collection_impl.cpp
index c60e5b17671..7863838bee5 100644
--- a/src/mongo/db/catalog/collection_impl.cpp
+++ b/src/mongo/db/catalog/collection_impl.cpp
@@ -679,6 +679,8 @@ Collection::Validator CollectionImpl::parseValidator(
auto expCtx = make_intrusive<ExpressionContext>(
opCtx, CollatorInterface::cloneCollator(_shared->_collator.get()), ns());
+ expCtx->variables.setDefaultRuntimeConstants(opCtx);
+
// The MatchExpression and contained ExpressionContext created as part of the validator are
// owned by the Collection and will outlive the OperationContext they were created under.
expCtx->opCtx = nullptr;