Group
Aggregation function is a type of function used in data processing by grouping values into categories in order to find a significant meaning. The common aggregate functions include Count, Average, Maximum, Minimum, and Sum. However, we may perform more complicated statistical functions, such as Mode or Standard Deviation. Typically, the grouping is performed with the SQL Group by
statement, as is shown in the following code; additionally, we may use aggregation functions, such as COUNT
, MAX
, MIN
, and SUM
in order to retrieve summarized information:
SELECT sentiment, COUNT(*)
FROM Tweets
GROUP BY sentiment
In MongoDB, we can use the Group
function, which is similar to the SQL Group By
statement. However, the Group
function doesn't work in shared systems, and the result size is limited to 10,000 documents (20,000 in version 2.2 or higher). Due to this, the Group
function is not very often used. Nevertheless, it is an easy way to find aggregate information when we have only one...