Yet another quick question. @Scott: When you say reduce batchsize, I
am assuming that you mean using limit, right?
If I need my cursor to return all the records from server, which may
be a huge number, can I give the count of all records as a parameter
to limit?
for eg:
int count = mongoConnection.getDBCollection("CPD").find().count();
DBCursor dbCursor =
mongoConnection.getDBCollection("CPD").find().limit(count);
would this be a valid replacement for Bytes.QUERYOPTION_NOTIMEOUT and
a solution to avoid Cursor time outs?
- Ravi
On Jan 28, 3:11 pm, Scott Hernandez <
scotthernan...@gmail.com> wrote:
> No.
>
> You can also reduce the batchsize.
>
> Making the default notimeout is generally bad.
> On Jan 28, 2012 3:39 PM, "Ravi Dontharaju" <
ravi.donthar...@gmail.com>
> wrote:
>
>
>
>
>
>
>
> > Hi All,
>
> > I was receiving the following exception while running a long batch job
> > to write/read data from an instance of MongoDB.
> > Exception in thread "main" com.mongodb.MongoException$CursorNotFound:
> > cursor not found on server
> > at com.mongodb.DBApiLayer$Result.init(DBApiLayer.java:391)
> > at com.mongodb.DBApiLayer$Result._advance(DBApiLayer.java:454)
>
> > I noticed that this was a pretty common issue and two best options to
> > resolve it are to
> > 1. Set a limit to the DBCursors
> > 2.
> >
http://api.mongodb.org/java/2.5.3/com/mongodb/Bytes.html#QUERYOPTION_...