How to use limit() function in Mongodb

This query will get all documents that contain MID = “53c6bfbc1ee2f2ed0acb1f0a”, don’t include 2 fields “Cap” and “Type”

$pID = "53c6bfbc1ee2f2ed0acb1f0a";
$cursor = $collection->find(array('MID'=>$pID), array("Cap"=>0, "Type"=>0));

If you wish to limit only 2 documents returned instead of 2000. You can use either 1 of these method below:

$pID = "53c6bfbc1ee2f2ed0acb1f0a";
$cursor = $collection->find(array('MID'=>$pID), array("Cap"=>0, "Type"=>0))->limit(2);

Or
$cursor = $collection->find(array('MID'=>$pID), array("Cap"=>0, "Type"=>0));
$cursor->limit(2);