-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 2.2.0
-
Component/s: Aggregation Framework
-
None
-
Environment:Ubuntu 12.04, installed from 10gen ppa
-
ALL
This works as expected:
> db.b.insert({k:{a:2,b:1},v:567}) > db.b.insert({k:{a:1,b:1},v:111}) > db.b.insert({k:{a:1,b:2},v:12}) > db.b.insert({k:{a:2,b:2},v:22}) > db.b.aggregate({$group:{_id:'$k.a', s:{$sum:'$v'}}}) { "result" : [ { "_id" : 1, "s" : 123 }, { "_id" : 2, "s" : 589 } ], "ok" : 1 }
But when using _id instead of k, it doesn't:
> db.a.insert({_id:{a:1,b:1},v:123}) > db.a.insert({_id:{a:1,b:2},v:345}) > db.a.insert({_id:{a:2,b:2},v:222}) > db.a.insert({_id:{a:2,b:1},v:567}) > db.a.aggregate({$group:{_id:'$_id.a', s:{$sum:'$v'}}}) { "result" : [ { "_id" : null, "s" : 1257 } ], "ok" : 1 }
- is duplicated by
-
SERVER-7805 Unable to access _id subdocuments in $group
- Closed