Tested in Aqua Data Studio 14.0.0-rc-39 Build #: 34238 on Ubuntu 12.04( Mongo DB 2.4.3) and Windows XP ( Mongo DB 2.0.9).
Program creates internal aliases for the dotted names in the $group by changing dotts on the "_" but then does not uses them in the $project.
See next example:
drop collection subdoc
go
insert into subdoc(a,b) values ({numcollect:{"one":1,"two":2}},1)
go
select month(date()) from subdoc where "a.numcollect.one" = 1 group by b,"a.numcollect.one" having "a.numcollect.one"= 1
--empty result set
--Because program sends wrong aggregate command:
--[ { "$project" : { "month(date())" : { "$month" : ISODate('2013-10-03T12:09:01.110Z') }, "b" : 1, "a" : 1 } }, { "$match" : { "a.numcollect.one" : 1 } }, { "$group" : { "_id" : { "b" : '$b', "a_numcollect_one" : '$a.numcollect.one' } } }, { "$project" : { "_id" : 0, "b" : '$_id.b', "a.numcollect.one" : '$_id.a.numcollect.one' } }, { "$project" : { "month(date())" : { "$month" : ISODate('2013-10-03T12:09:01.110Z') }, "b" : 1, "a.numcollect.one" : 1 } }, { "$match" : { "a.numcollect.one" : 1 } } ]
--correct shell command:
--db.subdoc.aggregate( { "$project" : { "month(date())" : { "$month" : ISODate('2013-10-03T12:09:01.110Z') }, "b" : 1, "a" : 1 } }, { "$match" : { "a.numcollect.one" : 1 } }, { "$group" : { "_id" : { "b" : '$b', "a_numcollect_one" : '$a.numcollect.one' } } }, { "$project" : { "_id" : 0, "b" : '$_id.b', "a.numcollect.one" : '$_id.a_numcollect_one' } }, { "$project" : { "month(date())" : { "$month" : ISODate('2013-10-03T12:09:01.110Z') }, "b" : 1, "a.numcollect.one" : 1 } }, { "$match" : { "a.numcollect.one" : 1 } },{$project:{"month(date())":1}} )
go
Emil, please investigate and let us know the impact of this fix.