Apply limit in mapreduce function in php?
- by Rohan Kumar
How to apply limit in php, mongodb when using mapreduce function?
I tried this
$cmd=array(// codition array
"mapreduce" => "user",
"map" => $map,
"reduce" => $reduce,
"out" => array("inline" => 1),
"limit"=>2
);
$db=connect();
$query = $db->command($cmd);// run command
But its not working it gives 2 documents.I can't use limit on sub documents.
If I have 100's of sub documents and then I want paging in sub documents.Then it fails.Is it possible to apply limit on sub documents?