summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mongo/db/pipeline/document_source_sort.cpp5
-rw-r--r--src/mongo/db/pipeline/pipeline_d.cpp14
2 files changed, 6 insertions, 13 deletions
diff --git a/src/mongo/db/pipeline/document_source_sort.cpp b/src/mongo/db/pipeline/document_source_sort.cpp
index e1ee0f3e6f3..84b28d6fde9 100644
--- a/src/mongo/db/pipeline/document_source_sort.cpp
+++ b/src/mongo/db/pipeline/document_source_sort.cpp
@@ -151,7 +151,10 @@ REGISTER_DOCUMENT_SOURCE_CONDITIONALLY(
: AllowedWithApiStrict::kInternal,
::mongo::getTestCommandsEnabled() ? AllowedWithClientType::kAny
: AllowedWithClientType::kInternal,
- feature_flags::gFeatureFlagBucketUnpackWithSort.getVersion(),
+ // We don't expect mongos or clients to produce this stage:
+ // We only generate it after multiplanning, which means only within one mongod process.
+ // So, we should be allowed to parse this stage regardless of FCV.
+ boost::none /*minVersion*/,
feature_flags::gFeatureFlagBucketUnpackWithSort.isEnabledAndIgnoreFCV());
DocumentSource::GetNextResult::ReturnStatus DocumentSourceSort::timeSorterPeek() {
diff --git a/src/mongo/db/pipeline/pipeline_d.cpp b/src/mongo/db/pipeline/pipeline_d.cpp
index d2c09df5604..ad6adf44eaa 100644
--- a/src/mongo/db/pipeline/pipeline_d.cpp
+++ b/src/mongo/db/pipeline/pipeline_d.cpp
@@ -1218,12 +1218,7 @@ PipelineD::buildInnerQueryExecutorGeneric(const MultipleCollectionAccessor& coll
// sort optimization. We check eligibility and perform the rewrite here.
auto [unpack, sort] = findUnpackThenSort(pipeline->_sources);
QueryPlannerParams plannerOpts;
- if (serverGlobalParams.featureCompatibility.isVersionInitialized() &&
- serverGlobalParams.featureCompatibility.isGreaterThanOrEqualTo(
- multiversion::FeatureCompatibilityVersion::kVersion_6_0) &&
- feature_flags::gFeatureFlagBucketUnpackWithSort.isEnabled(
- serverGlobalParams.featureCompatibility) &&
- unpack && sort) {
+ if (feature_flags::gFeatureFlagBucketUnpackWithSort.isEnabledAndIgnoreFCV() && unpack && sort) {
plannerOpts.traversalPreference = createTimeSeriesTraversalPreference(unpack, sort);
}
@@ -1245,12 +1240,7 @@ PipelineD::buildInnerQueryExecutorGeneric(const MultipleCollectionAccessor& coll
// If this is a query on a time-series collection then it may be eligible for a post-planning
// sort optimization. We check eligibility and perform the rewrite here.
- if (serverGlobalParams.featureCompatibility.isVersionInitialized() &&
- serverGlobalParams.featureCompatibility.isGreaterThanOrEqualTo(
- multiversion::FeatureCompatibilityVersion::kVersion_6_0) &&
- feature_flags::gFeatureFlagBucketUnpackWithSort.isEnabled(
- serverGlobalParams.featureCompatibility) &&
- unpack && sort) {
+ if (feature_flags::gFeatureFlagBucketUnpackWithSort.isEnabledAndIgnoreFCV() && unpack && sort) {
auto execImpl = dynamic_cast<PlanExecutorImpl*>(exec.get());
if (execImpl) {