Tested in Aqua Data Studio 14.0.0-rc-39 Build #: 34238 on Ubuntu 12.04( Mongo DB 2.4.3)
select month(date()) as mnn,AVG(valuation) as a,min(city) as c from baseball where mnn=9 and city in ['Chicago','NewYork'] and stats[0].year in [1904] and teamName='Cubs-2' and ((managerName.first='John') or (colors[0]='blue')) group by valuation
select month(dates) from orddate where month(dates) <=12 and funds>1 group by dates
select dates+1 from orddate where month(dates)=12 and year(dates)=2012 group by dates
|
120 KB
2.--Without GROUP BYselect month(dates) from orddate where month(dates) <=12 and funds>1--The expression 'funds' should appear among the SELECT fields
2.--Without GROUP BYselect month(dates) from orddate where month(dates) <=12 and funds>1--The expression 'funds' should appear among the SELECT fields
Sorry, I tested on older VMWare virtual machine. I found other SQL with same error and edit ticket.
Sorry, I tested on older VMWare virtual machine. I found other SQL with same error and edit ticket.
Necessary to use same program code for such case.
It's not quite possible in this case to use the same approach because when the GROUP BY clause is not present, the $group pipeline operator becomes optional inside the implementation (i.e. it is used only if there are some aggregate functions like min(), max(), sum(), addToSet() etc). That's why the implementation is different and we get different results, but I agree that for scenarios like these we should get the same resultsets.
--Without GROUP BYselect month(date()) as mnn,AVG(valuation) as a,min(city) as c from baseballwhere mnn=9 and city in ['Chicago','NewYork'] and stats[0].year in [1904] and teamName='Cubs-2' and ((managerName.first='John') or (colors[0]='blue'))--Invalid query: cannot have both aggregate and conversion functions.
select month(dates) , funds from orddate
select mont(dates), avg(valuation) from baseball group by valuation
Necessary to use same program code for such case.
It's not quite possible in this case to use the same approach because when the GROUP BY clause is not present, the $group pipeline operator becomes optional inside the implementation (i.e. it is used only if there are some aggregate functions like min(), max(), sum(), addToSet() etc). That's why the implementation is different and we get different results, but I agree that for scenarios like these we should get the same resultsets.
--Without GROUP BYselect month(date()) as mnn,AVG(valuation) as a,min(city) as c from baseballwhere mnn=9 and city in ['Chicago','NewYork'] and stats[0].year in [1904] and teamName='Cubs-2' and ((managerName.first='John') or (colors[0]='blue'))--Invalid query: cannot have both aggregate and conversion functions.
select month(dates) , funds from orddate
select mont(dates), avg(valuation) from baseball group by valuation
Of course, workarounds are possible such as using month(dates) as an artificial group-by key,
Actually this is not a valid workaround because
select month(dates), funds from orddate group by funds
is not equivalent to
select month(dates), funds from orddate group by month(dates), funds
as the aggregation processes are different.
Of course, workarounds are possible such as using month(dates) as an artificial group-by key,
Actually this is not a valid workaround because
select month(dates), funds from orddate group by funds
is not equivalent to
select month(dates), funds from orddate group by month(dates), funds
as the aggregation processes are different.
I have no access to the source codes and can be wrong but seems to me that workflow is not depend on MongoDB aggregate statements. If you have methods something like "Mastering_$group", "Mastering_$match" etc. which make all necessary checks and error mesaging then workflow for all these statements go through these methods and such differences will be absent.
About scenario (1). Program should recognize that month(date( )) just a constant but not function on the field and does not show error in any cases.
In case when date conversion function has field as an argument necessary to treat them logicaly just as that field. So if $group is present and argument-field absent among groupped fields error should be same like in the next statement( just remove extra words "Can't display"):
SELECT dates,funds FROM orddate GROUP BY funds
-- Field "dates" is not present under the GROUP BY clause
go
But now instead of this error - exception occures:
SELECT month(dates),funds FROM orddate GROUP BY funds
-- Exception:Can't convert from BSON type E00 to date
go
I have no access to the source codes and can be wrong but seems to me that workflow is not depend on MongoDB aggregate statements. If you have methods something like "Mastering_$group", "Mastering_$match" etc. which make all necessary checks and error mesaging then workflow for all these statements go through these methods and such differences will be absent.
About scenario (1). Program should recognize that month(date( )) just a constant but not function on the field and does not show error in any cases.
In case when date conversion function has field as an argument necessary to treat them logicaly just as that field. So if $group is present and argument-field absent among groupped fields error should be same like in the next statement( just remove extra words "Can't display"):
SELECT dates,funds FROM orddate GROUP BY funds
-- Field "dates" is not present under the GROUP BY clause
go
But now instead of this error - exception occures:
SELECT month(dates),funds FROM orddate GROUP BY funds
-- Exception:Can't convert from BSON type E00 to date
go
Given the introduction of MongoJS, we won't be resolving this issue unless we get a customer request to do so.
@qa: pls ensure that this use case is supported in MongoJS
Given the introduction of MongoJS, we won't be resolving this issue unless we get a customer request to do so.
@qa: pls ensure that this use case is supported in MongoJS
Verified in ADSv17.0.0-dev-65
Please refer screenshot1.png
Verified in ADSv17.0.0-dev-65
Please refer screenshot1.png
Issue #10303 |
Closed |
Won't Fix |
Resolved |
Completion |
No due date |
No fixed build |
No time estimate |
Emil, please investigate and let us know what the problem is.