× Heads up!

Aqua Data Studio / nhilam

Follow
IDE for Relational Databases
×
slavakiev reported 2013-10-03T16:43:44Z  · last modified 2013-10-27T17:02:44Z

Error with projection dotted names from the $group


Priority Low
Complexity Unknown
Component MongoSQL
Version 14.0
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
 
1 attachment

Issue #10307

Closed
Fixed
Resolved 2013-10-09T13:57:44Z
 
 
Completion
No due date
Fixed Build ADS 14.0.0-2 (mongo-jdbc 1.3.8)
No time estimate

About AquaClusters Privacy Policy Support Version - 19.0.2-4 AquaFold, Inc Copyright © 2007-2017