@Deepak:
It seems like you a few issues. Let's break these down.
#1: how does cursor timeout work?
------
The MongoDB PHP driver has two different timeouts. One is a
"connection" timeout, the other is for "cursors". The "cursor" timeout
indicates how long you will wait for getting the next element from a
find() command.
Docs are here:
http://www.php.net/manual/en/mongocursor.timeout.php
Basic syntax is the following:
$cursor = $collection->find($query)->timeout($milliseconds);
#2: why you're timing out
------
The error you're getting basically says that you're taking more than
30 seconds to load a document from your collection.
> Any idea as to why this might be happening?
A couple of things to look at.
1. Are you writing to this data from somewhere else? If you have too
many writes waiting to happen, then your read could be waiting on all
of the writes.
2. Are you dropping the collection at any point?
3. Are you doing lots of writes to _other_ collections? MongoDB only
has one write thread for the whole instance, you could be
inadvertently locking this data.
At the least, it would be nice to know what else is happening on the
server. Are you just doing this one call and the map-reduce? Usually
people doing map reduces are first writing lots of data.
- Gates