summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jstests/core/array_comparison_correctness.js10
-rw-r--r--jstests/core/array_index_and_nonIndex_consistent.js3
2 files changed, 12 insertions, 1 deletions
diff --git a/jstests/core/array_comparison_correctness.js b/jstests/core/array_comparison_correctness.js
index 2ae3b6015b3..06509ecf1c7 100644
--- a/jstests/core/array_comparison_correctness.js
+++ b/jstests/core/array_comparison_correctness.js
@@ -116,4 +116,14 @@ assert(arrayEq(resultSet, expected), generateFailedEqString(resultSet, expected)
resultSet = coll.find({val: {$gt: [3, 3]}}).toArray();
expected = generateExpectedResults([1, 4, 5, 11, 13, 19, 21, 22]);
assert(arrayEq(resultSet, expected), generateFailedEqString(resultSet, expected));
+
+// $gt the empty array should return all arrays.
+resultSet = coll.find({val: {$gt: []}}).toArray();
+expected = generateExpectedResults([0, 1, 2, 4, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 21, 22, 23]);
+assert(arrayEq(resultSet, expected), generateFailedEqString(resultSet, expected));
+
+// $lt the empty array should return no arrays.
+resultSet = coll.find({val: {$lt: []}}).toArray();
+expected = generateExpectedResults([3, 6, 7, 8, 16]);
+assert(arrayEq(resultSet, expected), generateFailedEqString(resultSet, expected));
})();
diff --git a/jstests/core/array_index_and_nonIndex_consistent.js b/jstests/core/array_index_and_nonIndex_consistent.js
index ae5d5a6278f..9647bfa65d3 100644
--- a/jstests/core/array_index_and_nonIndex_consistent.js
+++ b/jstests/core/array_index_and_nonIndex_consistent.js
@@ -41,6 +41,7 @@ collList.forEach(function(collObj) {
{val: [MaxKey]},
{val: [MaxKey, 3]},
{val: [3, MaxKey]},
+ {val: []},
]));
});
@@ -48,7 +49,7 @@ const queryList = [
[2, 2], [0, 3], [3, 0], [1, 3], [3, 1], [1, 5], [5, 1], [1],
[3], [5], {"test": 2}, {"test": 6}, [true, true], [true], true, 1,
3, 5, null, [null], [], [MinKey], [MinKey, 2], [MinKey, 4],
- MinKey, [MaxKey], [MaxKey, 2], [MaxKey, 4], MaxKey,
+ MinKey, [MaxKey], [MaxKey, 2], [MaxKey, 4], MaxKey, [],
];
let failedLT = [];