Database Reference
In-Depth Information
{ "_id" : ObjectId("53213bc8ae5fcad63d0563ea"),
"first" : "E", "second" : "V", "count" : 381 }
{ "_id" : ObjectId("53213bc8ae5fcad63d0563eb"),
"first" : "Q", "second" : "O", "count" : 143 }
{ "_id" : ObjectId("53213bc8ae5fcad63d0563ec"),
"first" : "C", "second" : "I", "count" : 601 }
{ "_id" : ObjectId("53213bc8ae5fcad63d0563ed"),
"first" : "B", "second" : "C", "count" : 413 }
{ "_id" : ObjectId("53213bc8ae5fcad63d0563ee"),
"first" : "M", "second" : "D", "count" : 790 }
{ "_id" : ObjectId("53213bc8ae5fcad63d0563ef"),
"first" : "S", "second" : "Q", "count" : 699 }
{ "_id" : ObjectId("53213bc8ae5fcad63d0563f0"),
"first" : "A", "second" : "M", "count" : 615 }
. .. other output omitted
Type "it" for more
The first stage of an aggregation pipeline is usually a filtering step that acts
like the WHERE clause of a SQL statement. It is identified by a $match
statement, as in this example, which selects all of the elements with the “A”
as their value for the “first” element:
> db.aggtest.aggregate([{$match:{first:"A"}}]);
{
"result" : [
{
"_id" : ObjectId("53213bc8ae5fcad63d0563f0"),
"first" : "A",
"second" : "M",
"count" : 615
},
{
"_id" : ObjectId("53213bc8ae5fcad63d0563f4"),
"first" : "A",
"second" : "F",
"count" : 806
},
{
"_id" : ObjectId("53213bc8ae5fcad63d056402"),
Search WWH ::




Custom Search