× Heads up!

Aqua Data Studio / nhilam

Follow
IDE for Relational Databases
×
slavakiev reported 2013-07-31T12:53:35Z  · last modified 2013-08-02T17:47:54Z

Program does not include into the $project operator fields used in aggregation functions when $project operator exists


Priority Minor
Complexity Unknown
Component MongoSQL
Version 14.0

Tested Aqua Data Studio Aqua Data Studio 14.0.0-beta-74 Build #: 33340 on Ubuntu 12.04( Mongo DB 2.4.3)  and Windows XP ( Mongo DB 2.0.9).

Program does not include into the $project operator fields  used in aggregation functions when $project operator exists( e.g. when expressions is in the WHAT) and this causes empty results. See next statement and results:

select push(colors),max(city),addtoset(colors),min(valuation +4) from baseball group by valuation
go
--push(colors) max(city)  addtoset(colors)  min(valuation + 4)
------------------  -------------    -------------            ---------------
--[  ]              (null)         [  ]                     14
 
Program sends next aggregate command which does not include fields for aggregation functions into the $project:
[ { "$project" : { "valuation + 4" : { "$add" : [ "$valuation", 4 ] } } }, { "$group" : { "_id" : "$valuation", "push(colors)" : { "$push" : "$colors" }, "max(city)" : { "$max" : "$city" }, "addtoset(colors)" : { "$addToSet" : "$colors" }, "min(valuation + 4)" : { "$min" : "$valuation + 4" } } }, { "$project" : { "_id" : 0, "valuation" : "$_id", "push(colors)" : 1, "max(city)" : 1, "addtoset(colors)" : 1, "min(valuation + 4)" : 1 } } ]
 
Correct command should be:
 
db.baseball.aggregate( { "$project" : {valuation:1,city:1,colors:1,"valuation + 4" : { "$add" : [ "$valuation", 4 ] } } }, { "$group" : { "_id" : "$valuation", "push(colors)" : { "$push" : "$colors" }, "max(city)" : { "$max" : "$city" }, "addtoset(colors)" : { "$addToSet" : "$colors" }, "min(valuation + 4)" : { "$min" : "$valuation + 4" } } }, { "$project" : { "_id" : 0, "valuation" : "$_id", "push(colors)" : 1, "max(city)" : 1, "addtoset(colors)" : 1, "min(valuation + 4)" : 1 } } )
 
Such solution also helps to resolve ticket 9644. I link these tickets.
 

Issue #9690

Closed
Fixed
Resolved 2013-07-31T21:02:01Z
 
 
Completion
No due date
Fixed Build ADS 14.0.0-beta-76 (mongo-jdbc 1.2.6)
No time estimate

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