-
Type: Bug
-
Resolution: Fixed
-
Priority: Minor - P4
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Optimization
-
Fully Compatible
-
ALL
The $concatArrays accumulator (added as part of SERVER-16284) suffers from the same issue as SERVER-90597, so it needs a similar fix
db.test.find() { "_id" : 0, "n" : 3, "arr" : [ 0 ] } { "_id" : 1, "n" : 2, "arr" : [ 1 ] } { "_id" : 2, "n" : 1, "arr" : [ 2 ] } { "_id" : 3, "n" : 0, "arr" : [ 3 ] } db.test.aggregate([{$sort: {_id: 1}}, {$bucketAuto: {groupBy: "$n", buckets: 2, output: {foo: {$concatArrays: "$arr"}}}}]) { "_id" : { "min" : 0, "max" : 2 }, "foo" : [ 3, 2 ] } { "_id" : { "min" : 2, "max" : 3 }, "foo" : [ 1, 0 ] }
The order of the elements in the foo arrays should be swapped since the incoming document order is such that the values put into the foo array are increasing.
- related to
-
SERVER-90597 $bucketAuto $push does not preserve order
- Closed
-
SERVER-16284 Allow for $pushall / $push with $each to allow pushing all elements of array in $group
- Closed