@Karl..
I tried Connection Pooling .. I tried to open 100 connections using
for loop. But is not opening the 100 connection. it is just opening
only one connection.
//Are you possibly doing a find() and NOT iterating through the
//entire cursor? That could be a problem.
I am fetching 5 records every time. and i am iterating through the
limit. But the cursors are not closing.
Please check my below code.. help me..
try{
include_once ('con.php');
$regex = new MongoRegex("/^".$q."/");
$limit=5;
$cursor = $collection->find(array('nm' => $regex))-
>sort(array('p'=>1))->limit($limit);
if($cursor->count()==0){
$qArr=explode(" ",$q);
$RegexArr = array ();
for($i=0;$i<sizeof($qArr);$i++){
$RegexArr[$i]=new MongoRegex("/^".$qArr[$i]."/");
}
$cursor = $collection->find(array('kw' => array('$all'=>
$RegexArr)))->limit($limit);
}
if($cursor->count()==0){
$regex = new MongoRegex("/^".strtoupper($q)."/");
$cursor = $collection->find(array('elc' => $regex))-
>sort(array('p'=>4))->limit($limit);
}
if($cursor->count()==0){$data[]='[]';}
foreach ($cursor as $obj) {
$json = array();
//-- some code here for iterating fileds...
}
// unset($cursor);
$m->close();
} catch ( MongoConnectionException $e ){
echo 'Connection Error !'.$e;
exit();