Database Reference
In-Depth Information
"first" : "A",
"second" : "Q",
"count" : 377
},
...more content omitted...
{
"_id" : ObjectId("53213bc9ae5fcad63d0567c5"),
"first" : "A",
"second" : "G",
"count" : 769
}
],
"ok" : 1
}
Other filtering options are $limit and $skip .Mostlyusedfortesting asan
initial filter, the $limit filter restricts the number of elements entering the
aggregation, as in this example:
> db.aggtest.aggregate([{$limit:1}]);
{
"result" : [
{
"_id" : ObjectId("53213bc8ae5fcad63d0563e9"),
"first" : "S",
"second" : "W",
"count" : 762
}
],
"ok" : 1
}
The $limit command is more typically used after a grouping and sorting
operation to limit the output to the user. Similarly, the $skip command
will ignore some number of documents entering the filter. Combined with
$limit , it is often used after grouping, as well as to implement pagination:
> db.aggtest.aggregate([{$skip:10},{$limit:1}]);
{
Search WWH ::




Custom Search