I am running the php script which fetch data from mongodb. I have a very huge database and I am getting this exception ..my mongodb version is 1.6.5
PHP Fatal error: Uncaught exception 'MongoCursorTimeoutException'
with message 'cursor timed out
(timeout: 30000, time left: 0:0, status: 0)
My query is like this
private function executeRegex($start_date, $end_date, $source, $collection, $db)
{
$criteria = array(
'date' => array(
'$gte' => new MongoDate(strtotime($start_date)),
'$lt' => new MongoDate(strtotime($end_date))
),
'uid'=> array(
'$ne' => '-',
),
'source' => new MongoRegex($source)
);
$value = $db->command(array('distinct' => $collection, 'key' => 'uid', 'query' => $criteria));
return count($value['values']);
}
how can I set timeout to infinite so that i do nt get this exception
MongoCursor::$timeout = -1;
type above line in your php code. this set timeout for all queries . best regard,