diff options
author | Eric Cox <eric.cox@mongodb.com> | 2020-05-06 15:26:02 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-06-01 20:27:40 +0000 |
commit | cc318e18f225ccaae25b0e0c4c87d8ea91b59ba8 (patch) | |
tree | fd41fe5f08d3dc237dcadc762608b06e2775c032 /src/mongo/db/pipeline | |
parent | 8bf94a6b123c4a8d60f7b7fd8fd860976a726fbf (diff) | |
download | mongo-cc318e18f225ccaae25b0e0c4c87d8ea91b59ba8.tar.gz |
SERVER-47740 Plumbing for construction of a full ExpressionContext in the sharded case
Diffstat (limited to 'src/mongo/db/pipeline')
-rw-r--r-- | src/mongo/db/pipeline/expression_context_for_test.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/mongo/db/pipeline/expression_context_for_test.h b/src/mongo/db/pipeline/expression_context_for_test.h index 4e18ccb6f39..80e4f2ea772 100644 --- a/src/mongo/db/pipeline/expression_context_for_test.h +++ b/src/mongo/db/pipeline/expression_context_for_test.h @@ -149,6 +149,36 @@ public: } /** + * Constructor which sets the given OperationContext on the ExpressionContextForTest. This will + * also resolve the ExpressionContextForTest's ServiceContext from the OperationContext and + * accepts letParameters. + */ + ExpressionContextForTest(OperationContext* opCtx, + const NamespaceString& nss, + std::unique_ptr<CollatorInterface> collator, + const boost::optional<BSONObj>& letParameters = boost::none) + : ExpressionContext(opCtx, + boost::none, // explain + false, // fromMongos, + false, // needsMerge, + false, // allowDiskUse, + false, // bypassDocumentValidation, + false, // isMapReduce + nss, + RuntimeConstants(Date_t::now(), Timestamp(1, 0)), + std::move(collator), + std::make_shared<StubMongoProcessInterface>(), + {}, // resolvedNamespaces + {}, // collUUID + letParameters, + false // mayDbProfile + ), + _serviceContext(opCtx->getServiceContext()) { + // Resolve the TimeZoneDatabase to be used by this ExpressionContextForTest. + _setTimeZoneDatabase(); + } + + /** * Sets the resolved definition for an involved namespace. */ void setResolvedNamespace(const NamespaceString& nss, ResolvedNamespace resolvedNamespace) { |