From bed250ad75afa0d117b828ad85bba0bbc4f80efc Mon Sep 17 00:00:00 2001 From: Jordi Serra Torrens Date: Mon, 20 Nov 2023 11:52:08 +0000 Subject: [PATCH] Repro --- .../suites/aggregation_mongos_passthrough.yml | 1 + .../aggregation/sources/lookup/lookup_contains_text.js | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/buildscripts/resmokeconfig/suites/aggregation_mongos_passthrough.yml b/buildscripts/resmokeconfig/suites/aggregation_mongos_passthrough.yml index 446ae4ec5f4..281fa8f8a16 100644 --- a/buildscripts/resmokeconfig/suites/aggregation_mongos_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/aggregation_mongos_passthrough.yml @@ -41,6 +41,7 @@ executor: n: 20 fixture: class: ShardedClusterFixture + num_shards: 2 mongos_options: set_parameters: enableTestCommands: 1 diff --git a/jstests/aggregation/sources/lookup/lookup_contains_text.js b/jstests/aggregation/sources/lookup/lookup_contains_text.js index 09d556236e2..f7c2eeab24c 100644 --- a/jstests/aggregation/sources/lookup/lookup_contains_text.js +++ b/jstests/aggregation/sources/lookup/lookup_contains_text.js @@ -8,6 +8,9 @@ const inner = db.inner; outer.drop(); inner.drop(); +// Shard outer collection. Leave inner as unsharded. +assert.commandWorked(db.adminCommand({shardCollection: outer.getFullName(), key: {_id: 'hashed'}})) + const kNoTextScoreAvailableErrCode = 40218; // This pipeline is never legal, because the subpipeline projects out a textScore but does not @@ -100,4 +103,7 @@ pipeline = [ {$project: {score: {$meta: "textScore"}, as: 1}}, ]; -assertErrorCode(outer, pipeline, kNoTextScoreAvailableErrCode); \ No newline at end of file +// Note how the aggregation succeeds but its result is missing the 'score' field. +jsTest.log("--DEBUG--" + tojson(outer.aggregate(pipeline).toArray())); + +assertErrorCode(outer, pipeline, kNoTextScoreAvailableErrCode); -- 2.34.1