Tested Aqua Data Studio Aqua Data Studio 14.0.0-beta-68 Build #: 33238 on Ubuntu 12.04( Mongo DB 2.4.3) and Windows XP ( Mongo DB 2.0.9).
MongoSQL seems to be consistent with Oracle, MySQL, and SQL Server.
Oracle:
A COUNT(A)
------ -----------
1 1
(null) 0
MySQL:
a count(a)
------ -----------
(null) 0
1 1
SQL Server:
Warnings: --->
W (1): Warning: Null value is eliminated by an aggregate or other SET operation.
<---
a column2
------ ----------
(null) 0
1 1
Jenny, orther RDBMS do not count NULL's also when GROUP BY is apsent. But according to Emil's comment in the ticket 9425:
COUNT(<fieldname>) behaves as it was designed on the MongoSQL: to count only the documents that contain the<fieldname> . The JDBC driver uses the $exists operator to achieve this.
Thus regular count considers NULL values. That it is why I included "having field_exists(a)" to have the same case as regular count() does and see differences:
select count(a) from nullcoll
Jenny, orther RDBMS do not count NULL's also when GROUP BY is apsent. But according to Emil's comment in the ticket 9425:
COUNT(<fieldname>) behaves as it was designed on the MongoSQL: to count only the documents that contain the<fieldname> . The JDBC driver uses the $exists operator to achieve this.
Thus regular count considers NULL values. That it is why I included "having field_exists(a)" to have the same case as regular count() does and see differences:
select count(a) from nullcoll
Slava, if I understand your comment correctly, it is reporting a different problem. If you think that it should be fixed, then please open a separate issue.
What is reported in this issue is consistent with the behavior of other DBMSs.
Slava, if I understand your comment correctly, it is reporting a different problem. If you think that it should be fixed, then please open a separate issue.
What is reported in this issue is consistent with the behavior of other DBMSs.
Issue #9654 |
Closed |
Won't Fix |
Resolved |
Completion |
No due date |
No fixed build |
No time estimate |
2 issue links |
relates to #9658
Issue #9658COUNT() when working through MongoDB .count statement counts null values |
relates to #9644
Issue #9644Wrong realization of COUNT() in case when aggregation framework involved when GROUP BY is absent |
MongoSQL seems to be consistent with Oracle, MySQL, and SQL Server.
Oracle:
A COUNT(A)
------ -----------
1 1
(null) 0
MySQL:
a count(a)
------ -----------
(null) 0
1 1
SQL Server:
Warnings: --->
W (1): Warning: Null value is eliminated by an aggregate or other SET operation.
<---
a column2
------ ----------
(null) 0
1 1