-
Type: New Feature
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Aggregation Framework
-
Query Optimization
Currently, $group does not allow to have a constant integer in a group clause, on the other hand, it supports strings. For example
db.foo.aggregate([{$group:{_id: {a:"$a", d:1},c: {$sum:"$c"}}}]) assert: command failed: { "ok" : 0, "errmsg" : "$group does not support inclusion-style expressions", "code" : 17390, "codeName" : "Location17390" } : aggregate failed
If set d as a string we don't get any error
db.foo.aggregate([{$group:{_id: {a:"$a", d:"1"},c: {$sum:"$c"}}}])
In order to be consistent group should support also integer inside _id