summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline
diff options
context:
space:
mode:
authorHenrik Edin <henrik.edin@mongodb.com>2020-07-31 15:26:11 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-08-07 13:32:12 +0000
commit9de175fb3776415e7237e6c0af4b76f518adc451 (patch)
tree56a22e0f57be9937d53deed8f76fdbc2502639c3 /src/mongo/db/pipeline
parent21d5a8e5bd822e71e5fb8feb2f9e71a7e8cf25f9 (diff)
downloadmongo-9de175fb3776415e7237e6c0af4b76f518adc451.tar.gz
SERVER-47885 Added lookupCollectionByXXXForRead interface to the Collection catalog that returns collection as shared_ptr<const Collection>
AutoGetCollectionForRead and AutoGetCollectionForReadCommand now uses this and holds the shared_ptr. They return the collection as const. Const correct various places to make this possible. Moved some logic from Collection destructors to deregister from the catalog as they may now be destroyed at a later point.
Diffstat (limited to 'src/mongo/db/pipeline')
-rw-r--r--src/mongo/db/pipeline/document_source_change_stream_test.cpp56
-rw-r--r--src/mongo/db/pipeline/document_source_cursor.cpp4
-rw-r--r--src/mongo/db/pipeline/document_source_cursor.h4
-rw-r--r--src/mongo/db/pipeline/document_source_geo_near_cursor.cpp4
-rw-r--r--src/mongo/db/pipeline/document_source_geo_near_cursor.h4
-rw-r--r--src/mongo/db/pipeline/pipeline_d.cpp24
-rw-r--r--src/mongo/db/pipeline/pipeline_d.h14
-rw-r--r--src/mongo/db/pipeline/process_interface/common_mongod_process_interface.cpp8
8 files changed, 59 insertions, 59 deletions
diff --git a/src/mongo/db/pipeline/document_source_change_stream_test.cpp b/src/mongo/db/pipeline/document_source_change_stream_test.cpp
index 4f78a51f3b8..12c155b91b7 100644
--- a/src/mongo/db/pipeline/document_source_change_stream_test.cpp
+++ b/src/mongo/db/pipeline/document_source_change_stream_test.cpp
@@ -451,8 +451,8 @@ TEST_F(ChangeStreamStageTest, ShouldRejectBothStartAtOperationTimeAndResumeAfter
auto expCtx = getExpCtx();
// Need to put the collection in the collection catalog so the resume token is valid.
- std::unique_ptr<Collection> collection = std::make_unique<CollectionMock>(nss);
- CollectionCatalog::get(expCtx->opCtx).registerCollection(testUuid(), &collection);
+ std::shared_ptr<Collection> collection = std::make_shared<CollectionMock>(nss);
+ CollectionCatalog::get(expCtx->opCtx).registerCollection(testUuid(), std::move(collection));
ASSERT_THROWS_CODE(
DSChangeStream::createFromBson(
@@ -471,9 +471,9 @@ TEST_F(ChangeStreamStageTest, ShouldRejectBothStartAfterAndResumeAfterOptions) {
auto opCtx = expCtx->opCtx;
// Need to put the collection in the collection catalog so the resume token is validcollection
- std::unique_ptr<Collection> collection = std::make_unique<CollectionMock>(nss);
+ std::shared_ptr<Collection> collection = std::make_shared<CollectionMock>(nss);
auto& catalog = CollectionCatalog::get(opCtx);
- catalog.registerCollection(testUuid(), &collection);
+ catalog.registerCollection(testUuid(), std::move(collection));
ASSERT_THROWS_CODE(
DSChangeStream::createFromBson(
@@ -493,9 +493,9 @@ TEST_F(ChangeStreamStageTest, ShouldRejectBothStartAtOperationTimeAndStartAfterO
auto opCtx = expCtx->opCtx;
// Need to put the collection in the collection catalog so the resume token is valid.
- std::unique_ptr<Collection> collection = std::make_unique<CollectionMock>(nss);
+ std::shared_ptr<Collection> collection = std::make_shared<CollectionMock>(nss);
auto& catalog = CollectionCatalog::get(opCtx);
- catalog.registerCollection(testUuid(), &collection);
+ catalog.registerCollection(testUuid(), std::move(collection));
ASSERT_THROWS_CODE(
DSChangeStream::createFromBson(
@@ -514,9 +514,9 @@ TEST_F(ChangeStreamStageTest, ShouldRejectResumeAfterWithResumeTokenMissingUUID)
auto opCtx = expCtx->opCtx;
// Need to put the collection in the collection catalog so the resume token is valid.
- std::unique_ptr<Collection> collection = std::make_unique<CollectionMock>(nss);
+ std::shared_ptr<Collection> collection = std::make_shared<CollectionMock>(nss);
auto& catalog = CollectionCatalog::get(opCtx);
- catalog.registerCollection(testUuid(), &collection);
+ catalog.registerCollection(testUuid(), std::move(collection));
ASSERT_THROWS_CODE(
DSChangeStream::createFromBson(
@@ -1548,8 +1548,8 @@ TEST_F(ChangeStreamStageTest, DocumentKeyShouldIncludeShardKeyFromResumeToken) {
const auto opTime = repl::OpTime(ts, term);
const auto uuid = testUuid();
- std::unique_ptr<Collection> collection = std::make_unique<CollectionMock>(nss);
- CollectionCatalog::get(getExpCtx()->opCtx).registerCollection(uuid, &collection);
+ std::shared_ptr<Collection> collection = std::make_shared<CollectionMock>(nss);
+ CollectionCatalog::get(getExpCtx()->opCtx).registerCollection(uuid, std::move(collection));
BSONObj o2 = BSON("_id" << 1 << "shardKey" << 2);
auto resumeToken = makeResumeToken(ts, uuid, o2);
@@ -1593,8 +1593,8 @@ TEST_F(ChangeStreamStageTest, DocumentKeyShouldNotIncludeShardKeyFieldsIfNotPres
const auto opTime = repl::OpTime(ts, term);
const auto uuid = testUuid();
- std::unique_ptr<Collection> collection = std::make_unique<CollectionMock>(nss);
- CollectionCatalog::get(getExpCtx()->opCtx).registerCollection(uuid, &collection);
+ std::shared_ptr<Collection> collection = std::make_shared<CollectionMock>(nss);
+ CollectionCatalog::get(getExpCtx()->opCtx).registerCollection(uuid, std::move(collection));
BSONObj o2 = BSON("_id" << 1 << "shardKey" << 2);
auto resumeToken = makeResumeToken(ts, uuid, o2);
@@ -1635,8 +1635,8 @@ TEST_F(ChangeStreamStageTest, ResumeAfterFailsIfResumeTokenDoesNotContainUUID) {
const Timestamp ts(3, 45);
const auto uuid = testUuid();
- std::unique_ptr<Collection> collection = std::make_unique<CollectionMock>(nss);
- CollectionCatalog::get(getExpCtx()->opCtx).registerCollection(uuid, &collection);
+ std::shared_ptr<Collection> collection = std::make_shared<CollectionMock>(nss);
+ CollectionCatalog::get(getExpCtx()->opCtx).registerCollection(uuid, std::move(collection));
// Create a resume token from only the timestamp.
auto resumeToken = makeResumeToken(ts);
@@ -1688,8 +1688,8 @@ TEST_F(ChangeStreamStageTest, ResumeAfterWithTokenFromInvalidateShouldFail) {
auto expCtx = getExpCtx();
// Need to put the collection in the collection catalog so the resume token is valid.
- std::unique_ptr<Collection> collection = std::make_unique<CollectionMock>(nss);
- CollectionCatalog::get(expCtx->opCtx).registerCollection(testUuid(), &collection);
+ std::shared_ptr<Collection> collection = std::make_shared<CollectionMock>(nss);
+ CollectionCatalog::get(expCtx->opCtx).registerCollection(testUuid(), std::move(collection));
const auto resumeTokenInvalidate =
makeResumeToken(kDefaultTs,
@@ -2348,8 +2348,8 @@ TEST_F(ChangeStreamStageDBTest, DocumentKeyShouldIncludeShardKeyFromResumeToken)
const auto opTime = repl::OpTime(ts, term);
const auto uuid = testUuid();
- std::unique_ptr<Collection> collection = std::make_unique<CollectionMock>(nss);
- CollectionCatalog::get(getExpCtx()->opCtx).registerCollection(uuid, &collection);
+ std::shared_ptr<Collection> collection = std::make_shared<CollectionMock>(nss);
+ CollectionCatalog::get(getExpCtx()->opCtx).registerCollection(uuid, std::move(collection));
BSONObj o2 = BSON("_id" << 1 << "shardKey" << 2);
auto resumeToken = makeResumeToken(ts, uuid, o2);
@@ -2384,8 +2384,8 @@ TEST_F(ChangeStreamStageDBTest, DocumentKeyShouldNotIncludeShardKeyFieldsIfNotPr
const auto opTime = repl::OpTime(ts, term);
const auto uuid = testUuid();
- std::unique_ptr<Collection> collection = std::make_unique<CollectionMock>(nss);
- CollectionCatalog::get(getExpCtx()->opCtx).registerCollection(uuid, &collection);
+ std::shared_ptr<Collection> collection = std::make_shared<CollectionMock>(nss);
+ CollectionCatalog::get(getExpCtx()->opCtx).registerCollection(uuid, std::move(collection));
BSONObj o2 = BSON("_id" << 1 << "shardKey" << 2);
auto resumeToken = makeResumeToken(ts, uuid, o2);
@@ -2421,8 +2421,8 @@ TEST_F(ChangeStreamStageDBTest, DocumentKeyShouldNotIncludeShardKeyIfResumeToken
const auto opTime = repl::OpTime(ts, term);
const auto uuid = testUuid();
- std::unique_ptr<Collection> collection = std::make_unique<CollectionMock>(nss);
- CollectionCatalog::get(getExpCtx()->opCtx).registerCollection(uuid, &collection);
+ std::shared_ptr<Collection> collection = std::make_shared<CollectionMock>(nss);
+ CollectionCatalog::get(getExpCtx()->opCtx).registerCollection(uuid, std::move(collection));
// Create a resume token from only the timestamp.
auto resumeToken = makeResumeToken(ts);
@@ -2457,8 +2457,8 @@ TEST_F(ChangeStreamStageDBTest, ResumeAfterWithTokenFromInvalidateShouldFail) {
auto expCtx = getExpCtx();
// Need to put the collection in the collection catalog so the resume token is valid.
- std::unique_ptr<Collection> collection = std::make_unique<CollectionMock>(nss);
- CollectionCatalog::get(expCtx->opCtx).registerCollection(testUuid(), &collection);
+ std::shared_ptr<Collection> collection = std::make_shared<CollectionMock>(nss);
+ CollectionCatalog::get(expCtx->opCtx).registerCollection(testUuid(), std::move(collection));
const auto resumeTokenInvalidate =
makeResumeToken(kDefaultTs,
@@ -2478,8 +2478,8 @@ TEST_F(ChangeStreamStageDBTest, ResumeAfterWithTokenFromInvalidateShouldFail) {
TEST_F(ChangeStreamStageDBTest, ResumeAfterWithTokenFromDropDatabase) {
const auto uuid = testUuid();
- std::unique_ptr<Collection> collection = std::make_unique<CollectionMock>(nss);
- CollectionCatalog::get(getExpCtx()->opCtx).registerCollection(uuid, &collection);
+ std::shared_ptr<Collection> collection = std::make_shared<CollectionMock>(nss);
+ CollectionCatalog::get(getExpCtx()->opCtx).registerCollection(uuid, std::move(collection));
// Create a resume token from only the timestamp, similar to a 'dropDatabase' entry.
auto resumeToken = makeResumeToken(
@@ -2507,8 +2507,8 @@ TEST_F(ChangeStreamStageDBTest, ResumeAfterWithTokenFromDropDatabase) {
TEST_F(ChangeStreamStageDBTest, StartAfterSucceedsEvenIfResumeTokenDoesNotContainUUID) {
const auto uuid = testUuid();
- std::unique_ptr<Collection> collection = std::make_unique<CollectionMock>(nss);
- CollectionCatalog::get(getExpCtx()->opCtx).registerCollection(uuid, &collection);
+ std::shared_ptr<Collection> collection = std::make_shared<CollectionMock>(nss);
+ CollectionCatalog::get(getExpCtx()->opCtx).registerCollection(uuid, std::move(collection));
// Create a resume token from only the timestamp, similar to a 'dropDatabase' entry.
auto resumeToken = makeResumeToken(kDefaultTs);
diff --git a/src/mongo/db/pipeline/document_source_cursor.cpp b/src/mongo/db/pipeline/document_source_cursor.cpp
index 7c530ef0663..ba6151d341a 100644
--- a/src/mongo/db/pipeline/document_source_cursor.cpp
+++ b/src/mongo/db/pipeline/document_source_cursor.cpp
@@ -285,7 +285,7 @@ DocumentSourceCursor::~DocumentSourceCursor() {
}
DocumentSourceCursor::DocumentSourceCursor(
- Collection* collection,
+ const Collection* collection,
std::unique_ptr<PlanExecutor, PlanExecutor::Deleter> exec,
const intrusive_ptr<ExpressionContext>& pCtx,
CursorType cursorType,
@@ -316,7 +316,7 @@ DocumentSourceCursor::DocumentSourceCursor(
}
intrusive_ptr<DocumentSourceCursor> DocumentSourceCursor::create(
- Collection* collection,
+ const Collection* collection,
std::unique_ptr<PlanExecutor, PlanExecutor::Deleter> exec,
const intrusive_ptr<ExpressionContext>& pExpCtx,
CursorType cursorType,
diff --git a/src/mongo/db/pipeline/document_source_cursor.h b/src/mongo/db/pipeline/document_source_cursor.h
index 0418f60b877..a7794df2e2c 100644
--- a/src/mongo/db/pipeline/document_source_cursor.h
+++ b/src/mongo/db/pipeline/document_source_cursor.h
@@ -63,7 +63,7 @@ public:
* $cursor stage can return a sequence of empty documents for the caller to count.
*/
static boost::intrusive_ptr<DocumentSourceCursor> create(
- Collection* collection,
+ const Collection* collection,
std::unique_ptr<PlanExecutor, PlanExecutor::Deleter> exec,
const boost::intrusive_ptr<ExpressionContext>& pExpCtx,
CursorType cursorType,
@@ -112,7 +112,7 @@ public:
}
protected:
- DocumentSourceCursor(Collection* collection,
+ DocumentSourceCursor(const Collection* collection,
std::unique_ptr<PlanExecutor, PlanExecutor::Deleter> exec,
const boost::intrusive_ptr<ExpressionContext>& pExpCtx,
CursorType cursorType,
diff --git a/src/mongo/db/pipeline/document_source_geo_near_cursor.cpp b/src/mongo/db/pipeline/document_source_geo_near_cursor.cpp
index 1e5907a00b8..4277bd26424 100644
--- a/src/mongo/db/pipeline/document_source_geo_near_cursor.cpp
+++ b/src/mongo/db/pipeline/document_source_geo_near_cursor.cpp
@@ -51,7 +51,7 @@
namespace mongo {
boost::intrusive_ptr<DocumentSourceGeoNearCursor> DocumentSourceGeoNearCursor::create(
- Collection* collection,
+ const Collection* collection,
std::unique_ptr<PlanExecutor, PlanExecutor::Deleter> exec,
const boost::intrusive_ptr<ExpressionContext>& expCtx,
FieldPath distanceField,
@@ -66,7 +66,7 @@ boost::intrusive_ptr<DocumentSourceGeoNearCursor> DocumentSourceGeoNearCursor::c
}
DocumentSourceGeoNearCursor::DocumentSourceGeoNearCursor(
- Collection* collection,
+ const Collection* collection,
std::unique_ptr<PlanExecutor, PlanExecutor::Deleter> exec,
const boost::intrusive_ptr<ExpressionContext>& expCtx,
FieldPath distanceField,
diff --git a/src/mongo/db/pipeline/document_source_geo_near_cursor.h b/src/mongo/db/pipeline/document_source_geo_near_cursor.h
index 084e8b76bbe..f8d3b483914 100644
--- a/src/mongo/db/pipeline/document_source_geo_near_cursor.h
+++ b/src/mongo/db/pipeline/document_source_geo_near_cursor.h
@@ -60,7 +60,7 @@ public:
* nonnegative.
*/
static boost::intrusive_ptr<DocumentSourceGeoNearCursor> create(
- Collection*,
+ const Collection*,
std::unique_ptr<PlanExecutor, PlanExecutor::Deleter>,
const boost::intrusive_ptr<ExpressionContext>&,
FieldPath distanceField,
@@ -70,7 +70,7 @@ public:
const char* getSourceName() const final;
private:
- DocumentSourceGeoNearCursor(Collection*,
+ DocumentSourceGeoNearCursor(const Collection*,
std::unique_ptr<PlanExecutor, PlanExecutor::Deleter>,
const boost::intrusive_ptr<ExpressionContext>&,
FieldPath distanceField,
diff --git a/src/mongo/db/pipeline/pipeline_d.cpp b/src/mongo/db/pipeline/pipeline_d.cpp
index e436fc29334..adec324007d 100644
--- a/src/mongo/db/pipeline/pipeline_d.cpp
+++ b/src/mongo/db/pipeline/pipeline_d.cpp
@@ -105,7 +105,7 @@ namespace {
* percentage of the collection.
*/
StatusWith<unique_ptr<PlanExecutor, PlanExecutor::Deleter>> createRandomCursorExecutor(
- Collection* coll,
+ const Collection* coll,
const boost::intrusive_ptr<ExpressionContext>& expCtx,
long long sampleSize,
long long numRecords) {
@@ -176,7 +176,7 @@ StatusWith<unique_ptr<PlanExecutor, PlanExecutor::Deleter>> createRandomCursorEx
StatusWith<std::unique_ptr<PlanExecutor, PlanExecutor::Deleter>> attemptToGetExecutor(
const intrusive_ptr<ExpressionContext>& expCtx,
- Collection* collection,
+ const Collection* collection,
const NamespaceString& nss,
BSONObj queryObj,
BSONObj projectionObj,
@@ -262,7 +262,7 @@ StatusWith<std::unique_ptr<PlanExecutor, PlanExecutor::Deleter>> attemptToGetExe
*
* The 'collection' is required to exist. Throws if no usable 2d or 2dsphere index could be found.
*/
-StringData extractGeoNearFieldFromIndexes(OperationContext* opCtx, Collection* collection) {
+StringData extractGeoNearFieldFromIndexes(OperationContext* opCtx, const Collection* collection) {
invariant(collection);
std::vector<const IndexDescriptor*> idxs;
@@ -302,7 +302,7 @@ StringData extractGeoNearFieldFromIndexes(OperationContext* opCtx, Collection* c
} // namespace
std::pair<PipelineD::AttachExecutorCallback, std::unique_ptr<PlanExecutor, PlanExecutor::Deleter>>
-PipelineD::buildInnerQueryExecutor(Collection* collection,
+PipelineD::buildInnerQueryExecutor(const Collection* collection,
const NamespaceString& nss,
const AggregationRequest* aggRequest,
Pipeline* pipeline) {
@@ -352,7 +352,7 @@ PipelineD::buildInnerQueryExecutor(Collection* collection,
? DocumentSourceCursor::CursorType::kEmptyDocuments
: DocumentSourceCursor::CursorType::kRegular;
auto attachExecutorCallback =
- [cursorType](Collection* collection,
+ [cursorType](const Collection* collection,
std::unique_ptr<PlanExecutor, PlanExecutor::Deleter> exec,
Pipeline* pipeline) {
auto cursor = DocumentSourceCursor::create(
@@ -376,7 +376,7 @@ PipelineD::buildInnerQueryExecutor(Collection* collection,
}
void PipelineD::attachInnerQueryExecutorToPipeline(
- Collection* collection,
+ const Collection* collection,
PipelineD::AttachExecutorCallback attachExecutorCallback,
std::unique_ptr<PlanExecutor, PlanExecutor::Deleter> exec,
Pipeline* pipeline) {
@@ -388,7 +388,7 @@ void PipelineD::attachInnerQueryExecutorToPipeline(
}
}
-void PipelineD::buildAndAttachInnerQueryExecutorToPipeline(Collection* collection,
+void PipelineD::buildAndAttachInnerQueryExecutorToPipeline(const Collection* collection,
const NamespaceString& nss,
const AggregationRequest* aggRequest,
Pipeline* pipeline) {
@@ -487,7 +487,7 @@ auto buildProjectionForPushdown(const DepsTracker& deps, Pipeline* pipeline) {
} // namespace
std::pair<PipelineD::AttachExecutorCallback, std::unique_ptr<PlanExecutor, PlanExecutor::Deleter>>
-PipelineD::buildInnerQueryExecutorGeneric(Collection* collection,
+PipelineD::buildInnerQueryExecutorGeneric(const Collection* collection,
const NamespaceString& nss,
const AggregationRequest* aggRequest,
Pipeline* pipeline) {
@@ -565,7 +565,7 @@ PipelineD::buildInnerQueryExecutorGeneric(Collection* collection,
(pipeline->peekFront() && pipeline->peekFront()->constraints().isChangeStreamStage());
auto attachExecutorCallback =
- [cursorType, trackOplogTS](Collection* collection,
+ [cursorType, trackOplogTS](const Collection* collection,
std::unique_ptr<PlanExecutor, PlanExecutor::Deleter> exec,
Pipeline* pipeline) {
auto cursor = DocumentSourceCursor::create(
@@ -576,7 +576,7 @@ PipelineD::buildInnerQueryExecutorGeneric(Collection* collection,
}
std::pair<PipelineD::AttachExecutorCallback, std::unique_ptr<PlanExecutor, PlanExecutor::Deleter>>
-PipelineD::buildInnerQueryExecutorGeoNear(Collection* collection,
+PipelineD::buildInnerQueryExecutorGeoNear(const Collection* collection,
const NamespaceString& nss,
const AggregationRequest* aggRequest,
Pipeline* pipeline) {
@@ -620,7 +620,7 @@ PipelineD::buildInnerQueryExecutorGeoNear(Collection* collection,
locationField = geoNearStage->getLocationField(),
distanceMultiplier =
geoNearStage->getDistanceMultiplier().value_or(1.0)](
- Collection* collection,
+ const Collection* collection,
std::unique_ptr<PlanExecutor, PlanExecutor::Deleter> exec,
Pipeline* pipeline) {
auto cursor = DocumentSourceGeoNearCursor::create(collection,
@@ -638,7 +638,7 @@ PipelineD::buildInnerQueryExecutorGeoNear(Collection* collection,
StatusWith<std::unique_ptr<PlanExecutor, PlanExecutor::Deleter>> PipelineD::prepareExecutor(
const intrusive_ptr<ExpressionContext>& expCtx,
- Collection* collection,
+ const Collection* collection,
const NamespaceString& nss,
Pipeline* pipeline,
const boost::intrusive_ptr<DocumentSourceSort>& sortStage,
diff --git a/src/mongo/db/pipeline/pipeline_d.h b/src/mongo/db/pipeline/pipeline_d.h
index 78f3fedb1bd..ec1baacf6fd 100644
--- a/src/mongo/db/pipeline/pipeline_d.h
+++ b/src/mongo/db/pipeline/pipeline_d.h
@@ -67,7 +67,7 @@ public:
* the new stage to the pipeline.
*/
using AttachExecutorCallback = std::function<void(
- Collection*, std::unique_ptr<PlanExecutor, PlanExecutor::Deleter>, Pipeline*)>;
+ const Collection*, std::unique_ptr<PlanExecutor, PlanExecutor::Deleter>, Pipeline*)>;
/**
* This method looks for early pipeline stages that can be folded into the underlying
@@ -88,7 +88,7 @@ public:
* 'nullptr'.
*/
static std::pair<AttachExecutorCallback, std::unique_ptr<PlanExecutor, PlanExecutor::Deleter>>
- buildInnerQueryExecutor(Collection* collection,
+ buildInnerQueryExecutor(const Collection* collection,
const NamespaceString& nss,
const AggregationRequest* aggRequest,
Pipeline* pipeline);
@@ -101,7 +101,7 @@ public:
* 'nullptr'.
*/
static void attachInnerQueryExecutorToPipeline(
- Collection* collection,
+ const Collection* collection,
AttachExecutorCallback attachExecutorCallback,
std::unique_ptr<PlanExecutor, PlanExecutor::Deleter> exec,
Pipeline* pipeline);
@@ -112,7 +112,7 @@ public:
* used when the executor attachment phase doesn't need to be deferred and the $cursor stage
* can be created right after buiding the executor.
*/
- static void buildAndAttachInnerQueryExecutorToPipeline(Collection* collection,
+ static void buildAndAttachInnerQueryExecutorToPipeline(const Collection* collection,
const NamespaceString& nss,
const AggregationRequest* aggRequest,
Pipeline* pipeline);
@@ -149,7 +149,7 @@ private:
* the 'pipeline'.
*/
static std::pair<AttachExecutorCallback, std::unique_ptr<PlanExecutor, PlanExecutor::Deleter>>
- buildInnerQueryExecutorGeneric(Collection* collection,
+ buildInnerQueryExecutorGeneric(const Collection* collection,
const NamespaceString& nss,
const AggregationRequest* aggRequest,
Pipeline* pipeline);
@@ -160,7 +160,7 @@ private:
* not exist, as the $geoNearCursor requires a 2d or 2dsphere index.
*/
static std::pair<AttachExecutorCallback, std::unique_ptr<PlanExecutor, PlanExecutor::Deleter>>
- buildInnerQueryExecutorGeoNear(Collection* collection,
+ buildInnerQueryExecutorGeoNear(const Collection* collection,
const NamespaceString& nss,
const AggregationRequest* aggRequest,
Pipeline* pipeline);
@@ -179,7 +179,7 @@ private:
*/
static StatusWith<std::unique_ptr<PlanExecutor, PlanExecutor::Deleter>> prepareExecutor(
const boost::intrusive_ptr<ExpressionContext>& expCtx,
- Collection* collection,
+ const Collection* collection,
const NamespaceString& nss,
Pipeline* pipeline,
const boost::intrusive_ptr<DocumentSourceSort>& sortStage,
diff --git a/src/mongo/db/pipeline/process_interface/common_mongod_process_interface.cpp b/src/mongo/db/pipeline/process_interface/common_mongod_process_interface.cpp
index 6c69dce204f..f2d9082f7f2 100644
--- a/src/mongo/db/pipeline/process_interface/common_mongod_process_interface.cpp
+++ b/src/mongo/db/pipeline/process_interface/common_mongod_process_interface.cpp
@@ -157,7 +157,7 @@ std::vector<Document> CommonMongodProcessInterface::getIndexStats(OperationConte
bool addShardName) {
AutoGetCollectionForReadCommand autoColl(opCtx, ns);
- Collection* collection = autoColl.getCollection();
+ const Collection* collection = autoColl.getCollection();
std::vector<Document> indexStats;
if (!collection) {
LOGV2_DEBUG(23881,
@@ -233,7 +233,7 @@ Status CommonMongodProcessInterface::appendQueryExecStats(OperationContext* opCt
str::stream() << "Database [" << nss.db().toString() << "] not found."};
}
- Collection* collection = autoColl.getCollection();
+ const Collection* collection = autoColl.getCollection();
if (!collection) {
return {ErrorCodes::NamespaceNotFound,
@@ -265,7 +265,7 @@ BSONObj CommonMongodProcessInterface::getCollectionOptions(OperationContext* opC
if (!autoColl.getDb()) {
return collectionOptions;
}
- Collection* collection = autoColl.getCollection();
+ const Collection* collection = autoColl.getCollection();
if (!collection) {
return collectionOptions;
}
@@ -291,7 +291,7 @@ CommonMongodProcessInterface::attachCursorSourceToPipelineForLocalRead(Pipeline*
: expCtx->ns;
autoColl.emplace(expCtx->opCtx,
nsOrUUID,
- AutoGetCollection::ViewMode::kViewsForbidden,
+ AutoGetCollectionViewMode::kViewsForbidden,
Date_t::max(),
AutoStatsTracker::LogMode::kUpdateTop);