-
Type:
Task
-
Resolution: Won't Fix
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Execution
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Accumulators ignore arrays or treat them as whole values.
A $min doesn't traverse into an array to find the min of 1,
> db.c.insert({a: 1, x: [1, 99]})
WriteResult({ "nInserted" : 1 })
> db.c.insert({a: 2, x: 10})
WriteResult({ "nInserted" : 1 })
> db.c.insert({a: 1, x: 10})
WriteResult({ "nInserted" : 1 })
> db.c.aggregate([{$group: {_id: "$a", m: {$min: "$x"}}}])
{ "_id" : 1, "m" : 10 }
A $min where a 'false' is compared to an array chooses the min as the array,
db.c.insert({a: 3, x: false})
db.c.insert({a: 3, x: [1,2]})
> db.c.aggregate([{$group: {_id: "$a", m: {$min: "$x"}}}])
{ "_id" : 1, "m" : 10 }
{ "_id" : 3, "m" : [ 1, 2 ] }
{ "_id" : 2, "m" : 10 }
This all means that we don't implicitly traverse arrays so could generate plans that chain together getFields() over the dotted paths instead of plans that use the sbe traverse stage.