Group
An 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 shown in the following code, additionally we may use aggregation functions such as COUNT
, MAX
, MIN
, SUM
in order to retrieve summarized information:
SELECT sentiment, COUNT(*) FROM Tweets GROUP BY sentiment
In MongoDB, we may use the group
function, which is similar to 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 the version 2.2 or newer). Due to this, the group
function is not highly used. Nevertheless, it is an easy way to find aggregate information when we have only one MongoDB instance...