What is meant by Derive database aggregates in NoSql databases.Please provide answers with some examples. I need to know how to write database aggregates for some particular database
1 Answers
What is Data aggregation?
It is any process in which information is gathered and expressed in a summary form, for purposes such as statistical analysis.
Data aggregation is done by using standard functions on a data selection (i.e. Query). The aggregation parameters are passed in as query parameters or as query hints.
Aggregations operations process data records and return computed results. Aggregation operations group values from multiple documents together, and can perform a variety of operations on the grouped data to return a single result.
Taking Mongodb as our NOSQL database:
Basic syntax of aggregate() method is as follows −
db.COLLECTION_NAME.aggregate(AGGREGATE_OPERATION)
For example:
db.mycol.aggregate([{$group : {_id : "$by_user", num_tutorial : {$sum : 1}}}])
Sql equivalent query for the above use case will be:
Select by_user, count(*) from mycol group by by_user.

- 1,831
- 2
- 18
- 26