summaryrefslogtreecommitdiff
path: root/jstests/aggregation/bugs/server14872.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/aggregation/bugs/server14872.js')
-rw-r--r--jstests/aggregation/bugs/server14872.js48
1 files changed, 24 insertions, 24 deletions
diff --git a/jstests/aggregation/bugs/server14872.js b/jstests/aggregation/bugs/server14872.js
index 3be4018ac21..4787df5259b 100644
--- a/jstests/aggregation/bugs/server14872.js
+++ b/jstests/aggregation/bugs/server14872.js
@@ -4,36 +4,36 @@
load('jstests/aggregation/extras/utils.js');
(function() {
- 'use strict';
+'use strict';
- var coll = db.agg_concat_arrays_expr;
- coll.drop();
+var coll = db.agg_concat_arrays_expr;
+coll.drop();
- assert.writeOK(coll.insert({a: [1, 2], b: ['three'], c: [], d: [[3], 4], e: null, str: 'x'}));
+assert.writeOK(coll.insert({a: [1, 2], b: ['three'], c: [], d: [[3], 4], e: null, str: 'x'}));
- // Basic concatenation.
- var pipeline = [{$project: {_id: 0, all: {$concatArrays: ['$a', '$b', '$c']}}}];
- assert.eq(coll.aggregate(pipeline).toArray(), [{all: [1, 2, 'three']}]);
+// Basic concatenation.
+var pipeline = [{$project: {_id: 0, all: {$concatArrays: ['$a', '$b', '$c']}}}];
+assert.eq(coll.aggregate(pipeline).toArray(), [{all: [1, 2, 'three']}]);
- // Concatenation with nested arrays.
- pipeline = [{$project: {_id: 0, all: {$concatArrays: ['$a', '$d']}}}];
- assert.eq(coll.aggregate(pipeline).toArray(), [{all: [1, 2, [3], 4]}]);
+// Concatenation with nested arrays.
+pipeline = [{$project: {_id: 0, all: {$concatArrays: ['$a', '$d']}}}];
+assert.eq(coll.aggregate(pipeline).toArray(), [{all: [1, 2, [3], 4]}]);
- // Concatenation with 1 argument.
- pipeline = [{$project: {_id: 0, all: {$concatArrays: ['$a']}}}];
- assert.eq(coll.aggregate(pipeline).toArray(), [{all: [1, 2]}]);
+// Concatenation with 1 argument.
+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: []}]);
+// 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}]);
- pipeline = [{$project: {_id: 0, all: {$concatArrays: ['$a', '$f']}}}];
- assert.eq(coll.aggregate(pipeline).toArray(), [{all: null}]);
+// Any nullish inputs will result in null.
+pipeline = [{$project: {_id: 0, all: {$concatArrays: ['$a', '$e']}}}];
+assert.eq(coll.aggregate(pipeline).toArray(), [{all: null}]);
+pipeline = [{$project: {_id: 0, all: {$concatArrays: ['$a', '$f']}}}];
+assert.eq(coll.aggregate(pipeline).toArray(), [{all: null}]);
- // Error on any non-array, non-null inputs.
- pipeline = [{$project: {_id: 0, all: {$concatArrays: ['$a', '$str']}}}];
- assertErrorCode(coll, pipeline, 28664);
+// Error on any non-array, non-null inputs.
+pipeline = [{$project: {_id: 0, all: {$concatArrays: ['$a', '$str']}}}];
+assertErrorCode(coll, pipeline, 28664);
}());