summaryrefslogtreecommitdiff
path: root/jstests/aggregation/sources/lookup/lookup_sort_limit.js
diff options
context:
space:
mode:
authorAlya Berciu <alyacarina@gmail.com>2021-08-24 11:07:06 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-08-24 11:32:16 +0000
commitf82bc1eb1b9b17ff8b1aeae818513aa843ddfcbd (patch)
tree66a76b83df09e3a4c22a90a2105c4a11e69fe5ea /jstests/aggregation/sources/lookup/lookup_sort_limit.js
parentb46e4629db7df9f7f99f80a992a3216fdf2428f5 (diff)
downloadmongo-f82bc1eb1b9b17ff8b1aeae818513aa843ddfcbd.tar.gz
SERVER-58955 Remove assumes_unsharded_collection tag for $lookup jstests
Diffstat (limited to 'jstests/aggregation/sources/lookup/lookup_sort_limit.js')
-rw-r--r--jstests/aggregation/sources/lookup/lookup_sort_limit.js14
1 files changed, 11 insertions, 3 deletions
diff --git a/jstests/aggregation/sources/lookup/lookup_sort_limit.js b/jstests/aggregation/sources/lookup/lookup_sort_limit.js
index 121a3c43f04..d5142a57af1 100644
--- a/jstests/aggregation/sources/lookup/lookup_sort_limit.js
+++ b/jstests/aggregation/sources/lookup/lookup_sort_limit.js
@@ -1,13 +1,12 @@
/**
* Test that a $lookup correctly optimizes a foreign pipeline containing a $sort and a $limit. This
* test is designed to reproduce SERVER-36715.
- *
- * @tags: [assumes_unsharded_collection]
*/
(function() {
"use strict";
-load("jstests/libs/analyze_plan.js"); // For getAggPlanStages().
+load("jstests/libs/analyze_plan.js"); // For getAggPlanStages().
+load("jstests/libs/fixture_helpers.js"); // For isSharded.
const testDB = db.getSiblingDB("lookup_sort_limit");
testDB.dropDatabase();
@@ -15,6 +14,15 @@ testDB.dropDatabase();
const localColl = testDB.getCollection("local");
const fromColl = testDB.getCollection("from");
+// Do not run the rest of the tests if the foreign collection is implicitly sharded but the flag to
+// allow $lookup/$graphLookup into a sharded collection is disabled.
+const getShardedLookupParam = db.adminCommand({getParameter: 1, featureFlagShardedLookup: 1});
+const isShardedLookupEnabled = getShardedLookupParam.hasOwnProperty("featureFlagShardedLookup") &&
+ getShardedLookupParam.featureFlagShardedLookup.value;
+if (FixtureHelpers.isSharded(fromColl) && !isShardedLookupEnabled) {
+ return;
+}
+
const bulk = fromColl.initializeUnorderedBulkOp();
for (let i = 0; i < 10; i++) {
bulk.insert({_id: i, foreignField: i});