June 2014
Intermediate to advanced
696 pages
38h 52m
English
The Collection object provides the aggregate() method to perform aggregation operations on data. The syntax for the aggregate() method is shown below:
aggregate(operators, [options], callback)
The operators parameter is an array of aggregation operators, shown in Table 15.3, that allows you to define what aggregation operation to perform on the data. The options parameter allows you to set the readPreference property, which defines where to read the data from. The callback parameter is a function that accepts an error as the first parameter and a results array as the second parameter. The results parameter is a fully aggregated object set return by the aggregation.
Table 15.3 ...
Read now
Unlock full access