In a previous question I wanted to obtain a count of the resulting groups using pipeline operations. As suggested, I used the following:
db.test.aggregate(
Unfortunately there is currently (as at MongoDB 2.2) no Aggregation Framework operator to $slice
or take a subset of an array.
You will need to use a workaround such as:
$skip
and $limit
in the aggregate()
pipelineThere is an existing feature request in the MongoDB issue tracker that you can upvote/watch: SERVER-6074: Allow $slice operator in $project.