Info |
---|
Queries with the MongoDB Aggregation Framework is not available in the Community Edition of Mongo Management Studio. |
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.
Codeblock |
---|
|
[
{
$group : {
_id : "$state",
totalPop : {
$sum : "$pop"
}
}
},
{
$match : {
totalPop : {
$gte : 10000000
}
}
}
] |
Hinweis |
---|
The queries must be embedded in an array. Are the appropriate braces left out, it leads to an error message. |
Tipp |
---|
A detailed documentation of the MongoDB AggregationFramework can be found here: http://docs.mongodb.org/manual/core/aggregation-introduction/ |