Aggregation framework

In this type of queries the results of several partial queries are merged and grouped together to form a new result. The following query returns a list of all US states, that have more than 10 million inhabitants.

[ {  $group : {  _id : "$state", totalPop : {  $sum : "$pop" }  }  }, {  $match : {  totalPop : { $gte : 10000000 }  } } ]

The queries must be embedded in an array. Are the appropriate braces left out, it leads to an error message.

A detailed documentation of the MongoDB AggregationFramework can be found here: http://docs.mongodb.org/manual/core/aggregation-introduction/