summaryrefslogtreecommitdiff
path: root/jstests/aggregation
diff options
context:
space:
mode:
authorTed Tuckman <ted.tuckman@mongodb.com>2023-01-23 15:28:16 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-01-23 16:35:37 +0000
commitc0cb6f12643f02e1a4f3aa5f7f1b10a313b3529f (patch)
treec58b831a5c1a51580ac6c435ff8cc60e822116e3 /jstests/aggregation
parente7643a84006dddaf997e1a50914afaf54f32abfd (diff)
downloadmongo-c0cb6f12643f02e1a4f3aa5f7f1b10a313b3529f.tar.gz
SERVER-73188 Rename test in partitions.js
Diffstat (limited to 'jstests/aggregation')
-rw-r--r--jstests/aggregation/sources/densify/partitions.js55
1 files changed, 28 insertions, 27 deletions
diff --git a/jstests/aggregation/sources/densify/partitions.js b/jstests/aggregation/sources/densify/partitions.js
index b686bff483e..6c3182e6bf3 100644
--- a/jstests/aggregation/sources/densify/partitions.js
+++ b/jstests/aggregation/sources/densify/partitions.js
@@ -166,33 +166,6 @@ function testFour() {
assert(arrayEq(resultArray, testExpected), buildErrorString(resultArray, testExpected));
}
-// One partition doesn't need densifying.
-function testFive() {
- coll.drop();
-
- const testDocs = [
- {val: 0, partition: 0},
- {val: 2, partition: 0},
- {val: 123, partition: 1},
- ];
- assert.commandWorked(coll.insert(testDocs));
-
- let result = coll.aggregate([
- {$project: {_id: 0}},
- {
- $densify: {
- field: "val",
- partitionByFields: ["partition"],
- range: {step: 1, bounds: "partition"}
- }
- }
- ]);
- const resultArray = result.toArray();
- const testExpected = testDocs.concat([{val: 1, partition: 0}]);
- assert(arrayEq(resultArray, testExpected), buildErrorString(resultArray, testExpected));
- coll.drop();
-}
-
// Verify the following test works in the full case without partitions.
function fullTestOne(stepVal = 1) {
coll.drop();
@@ -256,6 +229,33 @@ function testFive(stepVal = 1) {
assert(arrayEq(resultArray, testExpected), buildErrorString(resultArray, testExpected));
}
+// One partition doesn't need densifying.
+function testSix() {
+ coll.drop();
+
+ const testDocs = [
+ {val: 0, partition: 0},
+ {val: 2, partition: 0},
+ {val: 123, partition: 1},
+ ];
+ assert.commandWorked(coll.insert(testDocs));
+
+ let result = coll.aggregate([
+ {$project: {_id: 0}},
+ {
+ $densify: {
+ field: "val",
+ partitionByFields: ["partition"],
+ range: {step: 1, bounds: "partition"}
+ }
+ }
+ ]);
+ const resultArray = result.toArray();
+ const testExpected = testDocs.concat([{val: 1, partition: 0}]);
+ assert(arrayEq(resultArray, testExpected), buildErrorString(resultArray, testExpected));
+ coll.drop();
+}
+
// Test partitioning with full where partitions need to be densified at the end.
// Three partitions, each with only one document.
function fullTestTwo(stepVal = 2) {
@@ -645,6 +645,7 @@ testTwo();
testThree();
testFour();
testFive();
+testSix();
fullTestOne();
testFive();
fullTestOne(3);