php - Mongo fatal error -


i using php , mongo db... want user details using userkey unique

key.. mongo query :

       $obj= $mongo->user;        $filter = array(             'userkey'=>$value         );         $exist = $obj->findone($filter); 

when execute query, getting error ..

fatal error: maximum execution time of 30 seconds exceeded in line 5   

ie $exist = $obj->findone($filter); shows error

how solve problem

can me plz...

can mongo queries work, or 1 fails? connection database. believe "findone()" wait forever on stalled connection. recommend using "find()" instead, , giving low timeout, 100ms. may help.

$cursor = $collection->find($query,$fields)->timeout(100); $record = $cursor->getnext();

obviously, want wrap in try/catch block capture timeout exception. sure use latest mongo drivers (1.2.10 or better), because earlier versions of php mongo drivers segfault on connection timeout.


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -