From c540a205558830d6a2ec7147a004516f741b6e23 Mon Sep 17 00:00:00 2001 From: Charlie Swanson Date: Tue, 5 Oct 2021 01:49:50 +0000 Subject: SERVER-60520 Allow $searchMeta by default Default the 'enableSearchMeta' parameter to true --- jstests/aggregation/documents.js | 3 --- jstests/aggregation/variables/search_meta.js | 3 --- src/mongo/db/pipeline/document_source_union_with.cpp | 4 +++- src/mongo/db/query/query_knobs.idl | 2 +- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/jstests/aggregation/documents.js b/jstests/aggregation/documents.js index 5996b5dd4ff..deffe8fcf15 100644 --- a/jstests/aggregation/documents.js +++ b/jstests/aggregation/documents.js @@ -15,15 +15,12 @@ (function() { "use strict"; -load('jstests/libs/fixture_helpers.js'); // for runCommandOnEachPrimary. const writeConcernOptions = { writeConcern: {w: "majority"} }; const currDB = db; -FixtureHelpers.runCommandOnEachPrimary( - {db: db.getSiblingDB("admin"), cmdObj: {setParameter: 1, enableSearchMeta: true}}); const coll = currDB.documents; coll.drop(writeConcernOptions); coll.insert({a: 1}, writeConcernOptions); diff --git a/jstests/aggregation/variables/search_meta.js b/jstests/aggregation/variables/search_meta.js index 5a29598b6bc..b1e5ee71a1f 100644 --- a/jstests/aggregation/variables/search_meta.js +++ b/jstests/aggregation/variables/search_meta.js @@ -10,9 +10,6 @@ */ (function() { "use strict"; -load('jstests/libs/fixture_helpers.js'); // for runCommandOnEachPrimary. -FixtureHelpers.runCommandOnEachPrimary( - {db: db.getSiblingDB("admin"), cmdObj: {setParameter: 1, enableSearchMeta: true}}); const coll = db.searchCollector; coll.drop(); diff --git a/src/mongo/db/pipeline/document_source_union_with.cpp b/src/mongo/db/pipeline/document_source_union_with.cpp index 05f388ff87a..d54e95b8425 100644 --- a/src/mongo/db/pipeline/document_source_union_with.cpp +++ b/src/mongo/db/pipeline/document_source_union_with.cpp @@ -211,7 +211,9 @@ DocumentSource::GetNextResult DocumentSourceUnionWith::doGetNext() { logStartingSubPipeline(serializedPipe); // $$SEARCH_META can be set during runtime earlier in the pipeline, and therefore must be // copied to the subpipeline manually. - if (enableSearchMeta.load()) { + if (serverGlobalParams.featureCompatibility.getVersion() >= + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo44 && + enableSearchMeta.load()) { auto metaVal = pExpCtx->variables.getValue(Variables::kSearchMetaId, Document()); if (!metaVal.missing()) { _pipeline->getContext()->variables.setReservedValue( diff --git a/src/mongo/db/query/query_knobs.idl b/src/mongo/db/query/query_knobs.idl index d68433340a0..7eaba46f916 100644 --- a/src/mongo/db/query/query_knobs.idl +++ b/src/mongo/db/query/query_knobs.idl @@ -421,7 +421,7 @@ server_parameters: set_at: [ startup, runtime ] cpp_varname: "enableSearchMeta" cpp_vartype: AtomicWord - default: false + default: true enableTimeoutOfInactiveSessionCursors: description: "If true, cursors opened within sessions are eligible for inactive cursor timeout." -- cgit v1.2.1