So I have a collection oh data and each document has an array of comments, and I need to do a pagination and a sort.I tried something like this, but doesn't work:
$comments = $this->aggregate(array(
array('$match' => array('_id' => new \MongoId($id))),
array('$match' => array('comments' => array('$slice' => array($skip,$limit))))
));