diff options
author | Mihai Andrei <mihai.andrei@10gen.com> | 2022-01-27 19:17:32 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-01-27 19:44:58 +0000 |
commit | cd4b1025921a9ef28ce0e0466a18a849be4d80f1 (patch) | |
tree | cbe56cae571e521f3940ded112bbbcdad88ebddf /jstests/aggregation | |
parent | 7ebcd89a4f9590b0e17ad36588f6ef7c5a20a291 (diff) | |
download | mongo-cd4b1025921a9ef28ce0e0466a18a849be4d80f1.tar.gz |
SERVER-63008 [SBE] Return an empty array when $concatArrays has no children
Diffstat (limited to 'jstests/aggregation')
-rw-r--r-- | jstests/aggregation/bugs/server14872.js | 4 | ||||
-rw-r--r-- | jstests/aggregation/expressions/concat_arrays.js | 3 |
2 files changed, 3 insertions, 4 deletions
diff --git a/jstests/aggregation/bugs/server14872.js b/jstests/aggregation/bugs/server14872.js index f3e4abf85b6..8c0751a8e23 100644 --- a/jstests/aggregation/bugs/server14872.js +++ b/jstests/aggregation/bugs/server14872.js @@ -23,10 +23,6 @@ assert.eq(coll.aggregate(pipeline).toArray(), [{all: [1, 2, [3], 4]}]); pipeline = [{$project: {_id: 0, all: {$concatArrays: ['$a']}}}]; assert.eq(coll.aggregate(pipeline).toArray(), [{all: [1, 2]}]); -// Concatenation with no arguments. -pipeline = [{$project: {_id: 0, all: {$concatArrays: []}}}]; -assert.eq(coll.aggregate(pipeline).toArray(), [{all: []}]); - // Any nullish inputs will result in null. pipeline = [{$project: {_id: 0, all: {$concatArrays: ['$a', '$e']}}}]; assert.eq(coll.aggregate(pipeline).toArray(), [{all: null}]); diff --git a/jstests/aggregation/expressions/concat_arrays.js b/jstests/aggregation/expressions/concat_arrays.js index f4bf2241d0f..351d36dccf7 100644 --- a/jstests/aggregation/expressions/concat_arrays.js +++ b/jstests/aggregation/expressions/concat_arrays.js @@ -87,6 +87,9 @@ runAndAssert( ["$str_arr", {$filter: {input: [], cond: {$isArray: [{$concatArrays: [[], "$$this"]}]}}}], [["a", "b", "c"]]); +// Concatenation with no arguments results in the empty array. +runAndAssert([], [[]]); + // Confirm that having any combination of null or missing inputs and valid inputs produces null. runAndAssertNull(["$int_arr", "$null_val"]); runAndAssertNull(["$int_arr", null]); |